Chip's Tips for Developers

Contains coding, but not narcotic.

New OPML browser plugin for WordPress

March 28th, 2007 4:39:54 pm pst by Sterling Camden

Since I first released the OPML Blogroll widget, I’ve received numerous suggestions for enhancements. One that keeps coming up is the ability to show the hierarchy within the OPML file — categories, if you will.

Because of the way the original widget parses and displays the outline, this request was incompatible with the existing code. So I developed a new widget/plugin that does keep the hierarchy intact, and you can download it below. It also uses javascript to expand/collapse categories when the associated folder icon is clicked.

The code also includes an API for displaying an OPML browser within PHP code, so you don’t have to use the widget if your theme is not widget-compatible, or you want to display the browser somewhere else.

See the opml-browser-readme.txt file included in the download for full documentation and tips on how you can control the display through CSS styling to achieve some of the other suggested enhancements — such as scrolling within a limited height, bolding the categories, and removing the ability to expand/collapse categories.

There’s still one thing I haven’t figured out how to do, though. If the text of an item wraps, it wraps beneath the feed icon to the left. I’d like to be able to make it line up with the first line of text, but I’m not enough of a CSS wizard to manage that yet. Any suggestions?

UPDATE: Corrected a missing end-quote error in the autodiscovery link at 14:02 3-29-07

UPDATE: Get the latest version here.

Posted in JavaScript, OPML, PHP, RSS, Web, Wildly popular, WordPress | 15 Comments » RSS 2.0 | Sphere it!

15 Responses to “New OPML browser plugin for WordPress”

  1. [...] hierarchy within the OPML file (categories, usually) and lets you expand/collapse that hierarchy, go here. Tags:Chip’s Tips for Developers: blogroll caching opml phpopmlroll phpopmlroll12 regexen [...]

  2. Chip, you are the bomb! Thanks so much for your work on this excellent plugin.

  3. Glad you like it, Paul! Couldn’t have done it without your excellent suggestions.

  4. [...] the OPML Browser plugin for WordPress has only been released for two days and already we’re up to version 1.1. [...]

  5. forum says:

    It’s really works for me.Thanks dude.

  6. You’re welcome, um, “forum”

  7. Chip – just wanted to thank you again for this most awesome plugin!

  8. Thanks, Tony! Glad you like it. And thanks for the help in specifying and testing it.

  9. Wonderful! The only thing I’d add is the ability to have the folders collapsed by default. Maybe it’s there and I just missed it. Anyway, I hacked the php to achieve this result. Two really small changes: 1) in opml_browser_render_div(), change the default category image to ‘folder.png’ so that the icon is collapsed initially. and 2) in opml_browser_child_div(), test opml_browser_nextid. if it’s 1 then set display:block, otherwise set display:none. You can see the result at http:liferain.com/blog. It’d be nice to roll something like this into the next version with maybe a checkbox to control it on the widget. Anyway, thanks! Great plugin and the code was really clean and easy to read as well!

  10. LOL, Thanks! I missed that, but I’m glad that I did. Learned a lot from playing with it. :-) It’s nitpicking, but the way you do it in 1.1 appears to collapse the folders after they’re rendered. The method I described above will render them closed initially.

  11. Good point. I’ll have to include that in the next version.

  12. [...] New OPML browser plugin for WordPress — Chip’s Tips for Developers Since I first released the OPML Blogroll widget, I’ve received numerous suggestions for enhancements. One that keeps coming up is the ability to show the hierarchy within the OPML file — categories, if you will. (tags: opml plugin wordpress) [...]

  13. [...] version 1.2 via the button below.  Pinging back to all previous posts for those following [...]

  14. Harry says:

    Thanks for the informative post.

Leave a Reply

Better Tag Cloud