My New Bookmark Widget

Ok, I found a widget that could replace the bookmark widget by simply allowing a customizable interface to the wp_list_bookmarks function. This is a highly customizable function that not only lets you grab all the bookmarks, but allows customization of how they are displayed. The widget gives you an interface that lets you change parameters to the function without having to modify the template.

My 1st attempt at using the widget didn’t work. After examining the HTML, I realized that there were a few tags I needed to not leave at the default. I got the links to work how I want making the following modification in my functions file of the theme I’m using.

function widget_mytheme_blogroll() {
?>
-<h3>Blogroll</h3>
- <ul>
- <?php get_links(-1, '<li>', '</li>', ' - '); ?>
- <?php
+ wp_list_bookmarks('title_before=<h3>&title_after=</h3>&category_before=&category_after=');
- </ul>
-<? php
} ?>

This gave me the category tree and also changed the titles of the categories to be in the same format that the rest of the template was in.

Now that I’d figured out which parameters were of importance to me, I gave the link widget another go. I found that the reason I was having problems is that the category_before and category_after parameters are always displaying <li>,</li> respectively instead of my desired blank setting. I tried spaces, &nbsp; and even random strings. Nothing seemed to work so I went back to my hacked template function instead. Oh well, I guess I can hack additional themes not that I’ve got the basics of what I want down. It’d be nice to get that working in the widget though.

This entry was posted in Web and tagged , , , , . Bookmark the permalink.