TradingMetro
Member
Posted 3 years ago #
Hi,
Just wondering if I am overlooking something for the template tag "wp_list_bookmarks".
Is there an attribute to output the "RSS Address" of a link?
I'm looking for the same functionality as wp_list_categories's "feed_image" and "feed" attributes.
Is there an attribute to output the "RSS Address" of a link?
No
TradingMetro
Member
Posted 3 years ago #
Contrary to stvwlf, I've found a way to output the RSS feed URL.
http://outthinkgroup.com/2009/01/14/custom-wordpress-arrays-creating-a-favicon-fueled-link-list/
This post was very useful.
Instead of "wp_list_bookmarks", use "get_bookmarks" and use a foreach loop with link_rss.
Full code:
<?php
$bookmarks = array();
$bookmarks = get_bookmarks('category=52&orderby=notes');
foreach ($bookmarks as $bookmark) {
$rss = $bookmark->link_rss;
?>
<li><a title="<?php echo $bookmark->link_name; ?>" href="<?php echo clean_url($bookmark->link_url); ?>" target="_blank"><?php echo $bookmark->link_name; ?></a> <?php if ($rss != "") echo '<a href="'.$rss.'"><img src="IMAGE URL" alt="RSS" /></a>; ?></li>
<?php } ?>
Bartran
Member
Posted 2 years ago #
I keep getting t_string errors with this code and I don't know why. I think the problem is somewhere after the last echo.
hearvox
Member
Posted 2 years ago #
there's a missing single-quote after in above code after the final (should be ...alt="RSS" /></a>'; ?></li>...
this works (a few changes added: link_description to title, span around and title to feed url:
<?php
$bookmarks = array();
$bookmarks = get_bookmarks('category=10');
foreach ($bookmarks as $bookmark) {
$rss = $bookmark->link_rss;
$title = $bookmark->link_description;
?>
<li><a title="<?php echo $bookmark->link_name.': '.$bookmark->link_description; ?>" href="<?php echo clean_url($bookmark->link_url); ?>"><?php echo $bookmark->link_name; ?></a> <?php if ($rss != "") echo '<span class="link_feed">(<a href="'.$rss.'" title="'.$bookmark->link_name.' RSS">feed</a>)</span>'; ?></li>
<?php } ?>