I had a reader request for some help with their blogroll recently. The WordPress blogroll has gone through many changes over the past year, and a lot of the WordPress themes authors out there didn’t update their themes with the new code used to call the blogroll.
The old code still works, but it doesn’t let you take advantage of the new blogroll capabilities. If you have set up your blogroll with different categories, but noticed that all of them display under a single category, it is probably because your blog’s theme is still using the original code that didn’t allow for much configuration. You’ll probably find something like this:
<?php get_links()' ?>
or
<?php get_links_list()' ?>
If you want a more configurable code, you will want to use something like the following:
<?php wp_list_bookmarks('categorize=1&before=<li>&title_before=<h2>&title_after=</h2>&category_before=</n>&category_before=</n>&after=</li>&orderby=url'); ?>
This code will display your blogroll, but will let you have separate lists for your different blogroll categories. I’ve customized it to display the category title as a Header 2 and use bullet points to display the content, but you can do a variety of things. For more customization options, you’ll want to check out the WordPress List Bookmarks page and adjust the code as needed.












Wednesday, February 13th, 2008 at 3:30 am
This makes me wonder about the possibility for two things.
Would it be possible to have a page layout in your template where you would just list your blogroll as above mentioned (per category)?
And secondly would it be possible to have your regular blogroll show just the category of blogroll entries you desire depending on the category shown in the main article? This would be on a single post layout.
I mean, of all places, HackWordpress would be the place to openly wonder about these possibilities right?
Wednesday, February 13th, 2008 at 7:07 am
@ DeFries - You can certainly do that use the WordPress page template feature. Create a copy of your page.php file and rename it (obviously), then create the page in your page menu and find it in the Page Template drop-down box. I plan to write a tutorial with screenshots here at some point when time permits.
As for the second part, if I understand what you are saying, then yes I believe so. You should be able to find what you need in the above linked WordPress Link Bookmarks page.
Wednesday, February 13th, 2008 at 10:14 am
I’ve got the first part down. Worked like a charm, but I am wondering how to get it into columns. Any idea? ( http://www.de-fries.nl/links )
For the second part, aren’t your blogpost categories different from the blogroll categories? You would have to lock two specific categories together I’m imagining, but I can’t find how to do that in the Codex.
Friday, February 22nd, 2008 at 11:06 am
Thanks, your example help me a lot.
Sunday, February 24th, 2008 at 11:42 pm
Thanks! Your code was a big help. =)
Sunday, March 9th, 2008 at 1:30 pm
Thanks! The code works well - took me a few moments to realize the “blogroll” was in index.php in the case of the theme I have been using…..
Tuesday, August 26th, 2008 at 7:25 am
Great article, it solved the exact issue I was facing! I have been using your plugins and hacks a lot lately, they are all VERY helpful, thanks!