WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_list_bookmarks and RSS Address output (5 posts)

  1. TradingMetro
    Member
    Posted 5 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.

  2. stvwlf
    Member
    Posted 5 years ago #

    Is there an attribute to output the "RSS Address" of a link?

    No

  3. TradingMetro
    Member
    Posted 5 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&amp;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 } ?>
  4. Bartran
    Member
    Posted 5 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.

  5. hearvox
    Member
    Posted 4 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 } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic