WordPress Blogroll Dropdown
Jill Salzman (momtrepreneur) asked me to create a dropdown blogroll for her blog to help cleanup a long list of bookmarks that she likes to share with her readers.
Here is an example of how the Blogroll Pulldown looks on her site.

Of course the first thing I always do is search for an existing WordPress Plugin or Function. While doing this search I came across The Information Gateway blog which has a post about just such a function to add a dropdown blogroll. I tried the code TIG has posted but there was a small problem with it, so I modified the code to get it working.
My revised code is available here, simply add the function to your themes function file, and make the appropriate call as outlined in the code.
Hire Me
Related Posts
Written by: David Cooley - January 31st, 2009
Posted in Blogging, ProgrammingTags: Wordpress, Wordpress Blogroll, Wordpress Function, Wordpress Plugin








Thank you for revising the script. I did that script at the older wordpress. I’ve forgot in which version.
Andi, your welcome. If you have a new link I will be glad to add it. And thanks for doing the script the first time, it was a real time saver and very helpful.
What is captcha code?, pls provide me captcha code codes or plugin, Thanks in advance.
David,
Thanks a lot for this code, it works perfectly for me, but i have just two quick questions :
#1 how to make the links open in a new window ?
#2 how to organize them by category ?
on my blogroll manager, they are all set by categories and open in new window – would love to know how to make those two options incorporated into the drop down menu
otherwise thanks a lot for your code =]
Trendland,
Here is a revised version to solve both those issues,
BlogrollPulldown2.txt
That should do it, and I did test it on one of my sites.
Hi David
I am not a PHP person, but I would like to try to get this to work. I added the code to my functions.php file (I am using WP 2.7.1 and ‘This Just In’ as my template) but I haven’t figured out the most appropriate place to put the call. I’ve tried a few things, but no luck.
This is exactly what I am looking for, but I know I am missing something in order to use it properly. I am pretty comfortable with HTML, but this is a bit new to me.
Typically items like this are placed in the sidebar. With that said, the first thing you have to establish is whether you are using widgets or not. If you are using widgets this code has to go before or after the call to the widgets in the sidebar. If you are not using widgets, you can place the code in the sidebar code where you want it to appear.
If that does not help, send me your email address in the contact form on this site and I will try to help you some more.
sweet code.
I was trying to figure out if I can seperate links by category though. I seperate my blogroll olinks depending on what kind of link it is. Is it possible to only list links in one category, then use the code again to list link in another category?
I tried adding this in the function code: “cat_id = 2″… example:
“SELECT link_url, link_name, link_description FROM $wpdb->links WHERE link_visible = ‘Y’ , cat_id = 2 Order By link_name”;
doesn’t work though. any suggestions?
Trying the same thing as Danny – anyone have suggestions?
Danny, the problem is the category taxonomy changed some time ago. The Link Category (cat_id) is now held in the taxonomy files and takes extra work to validate through queries.
I will try to do this when I get some available time.
This is great! So easy, so quick. Can’t believe the difficulties I had trying to find a plugin or work-around. This solved it so fast!
My only thought and question: Would it possible to attach target=”_blank”? That way the blog roll links to completely remove the visitor from the site?
Ben,
I believe you could open the page in a new window.
It would probably require changing the document.location to window.open.
Thank you so much for this! It worked perfectly and it’s a huge bonus for it not being another plugin that I have to install! A lot of websites make accomplishing this feat so complicated.