For the most part I like how WordPress handles Links for a blogroll in that you can manage of list of these links in one or more categories.  The widget for displaying these links though is rather minimal in it capability.  You have only a couple of display options and you can list  either all or by category.

For podcasts I wanted to list both a link with the name of the podcast and  homepage url along with an RSS feed that can be subscribed to.  The link database does have a field for entering the RSS url though the template tag wp_list_bookmarks() does not support it.

Luckily I found that the get_bookmarks() template tag can be used to achieve this by dumping the bookmarks into an array and then looping through it and grabbing the properties I wanted.  For example:

$bookmarks = get_bookmarks(‘category_name=Podcast’);

Retrieved all the links in my category “Podcast”

I was then able to access the rss link with $bookmark->link_rss within a foreach loop.  The end result was that I could have a hyperlink to the Podcast homepage along with the standard RSS graphic wrapped by the RSS feed url as in the following example.

<!– Loop through each podcast and display link and rss link –>
<?php
$bookmarks = array();
$bookmarks = get_bookmarks(‘category_name=Podcast’);
foreach ( $bookmarks as $bookmark ) {
echo “<div>&bull;<a href=’$bookmark->link_url’>$bookmark->link_name</a> <a href=’$bookmark->link_rss’><img src=’../rss.png’ alt=’Subscribe to Podcast RSS’ width=’14′ height=’14′ border=’0′ /></a></div>”;
}
?>

I use the Executable PHP Code widget to make it easier since the standard Text widget only allows html and not PHP.

Tags: , ,