Jump to content

How to open RSS News feed link in new window?


kendalbren

Recommended Posts

Hi guys.

 

I'm afraid it's a terribly simple problem but basically I have an RSS new feed on my site and I'd like a new window to open when the user clicks the link to the news story. Everything except the new window problem is working ok - here's the code I have:

 

<?php
require_once (ABSPATH . WPINC . '/rss-functions.php');

$url = 'http://www.onestopclick.com/rss/Industry-News.xml';
$rss = fetch_rss( $url );
if ( $rss ) {
echo "<p>";
$i = 1;
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
$description = $item['description'];
echo "<a href=$href>$title</a>
<br />$description<br />";
if ($i == 2 ) break;
$i = $i + 1;
}
echo "</p>";
}
?>

 

I know I should use the

target="_blank" 

code but I don't know where to put it.

 

Thanks in advance.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.