Hitokiri
Member
Posted 3 years ago #
Hi
I´m using fetch_rss function to display some headlines of other blogs at the bottom of my blog.
I´m using the function as explained on the wiki:
<?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://example.com/rss/feed/goes/here');
echo '
';
?>
and everything seems OK
But when I click on a headline, and I´m supossed to go to the articles post, URL appears wrong. I get something like this:
http://labs.valechumbar.com/\%22http://feeds.feedburner.com/~r/Muyriver/~3/41656566/\%22
The first http:// is my blog (where the fetch_rss actually is), and the second one the rss blog where I´m supossed to be linked to.
When I click there I just return to my own blog, not going to the destination one
Any ideas on how to fix this?
Thanks in advance
Something is wrong with your code. You need to post *exactly* what your code looks like, instead of posting the wiki example again.
Also, when you post code, put it between backticks (that's the character below the tilde ~ ) so that we can actually see it.
Hitokiri
Member
Posted 3 years ago #
:s I didn´t realize i posted the code wrond
There it goes again:
<?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://feeds.feedburner.com/Muyriver');
echo '<ul>';
for($i=0;$i<5;$i++) {
$item=$rss->items[$i];
echo '<li><a href=\"' . $item['link'] . '\" title=\"' . $item['title'] . '\">' . $item['title'] . '</a></li>';
}
echo '</ul>';
?>
Ah. Okay. I was not aware that the wiki had screwed up the backslashes. All those backslashes in the echo line... You don't need 'em.
Try this code:
<?php
require_once(ABSPATH . WPINC . '/rss-functions.php');
$rss = fetch_rss('http://feeds.feedburner.com/Muyriver');
echo '<ul>';
for($i=0;$i<5;$i++) {
$item=$rss->items[$i];
echo '<li><a href="' . $item['link'] . '" title="' . $item['title'] . '">' . $item['title'] . '</a></li>';
}
echo '</ul>';
?>
Hitokiri
Member
Posted 3 years ago #
Great!
Now it workd perfectly. We should correct the wiki
Thank you very much Otto
Okay, I modified the Wiki. Appearantly, the wiki always adds backslashes to double quote marks like that. Annoying.