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.














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?
@ 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.
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.
Thanks, your example help me a lot.
Thanks! Your code was a big help. =)
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…..
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!
Thank you so much!
How can i hide the title?
Thanks,
ORiOn
I find out…
<?php wp_list_bookmarks(‘categorize=2&before=&category_before=&category_before=&after=&orderby=url&categorize=0&title_li=’); ?>
I have just put:
&categorize=0&title_li=
Hi, i want to show blogroll only when somebody click on category named “hosting”, but when we click on homepage or some other categories blogroll must disappear, how to do that?
@ Pero – I would recommend using WordPress conditional tags, then place the blogroll code into the conditional tags.
Kyle, I don’t suppose you could do a couple of tutorials on conditional tags?! I only ask because I had a little read of it on codex, and went from confused to even more confused! (That is unless you already have some here at WP Hacks, and I’ve just not seen them!)
Thanks
Mark
@ Mark –
I did write about them briefly here, but I would recommend you check out a more detailed write up of conditional tags by my friend Leland at Theme lab.
i solve problem with this:
Thanks for the link Kyle, it’s the kind of thing I’ve been after. Now I can go and have a little play around, and see what I can come up with!…
Thanks
Mark
Awesome! Thank you for posting this!
hi! this post has been very helpful to me. I’ve just started a self-hosted blog and this article helped much. thank you!
Thank at all, but I need to show link with description anybody can help me.
Thanks
Nice, best post I found on the subject.
If you add code of a full page template using your code it would be even more clear. Took me a few minutes to figure out that I still had to include if (have posts) and the_content tags.
Very nice. Configurable code, that is.
Thanx : )
I am so thankful to have found your help!! I have been looking for this code! Now I need help with the alignment to the left and putting in bullets under each subject/category…any suggestions?
Thank you!!
Thanks for the code, i was looking for it.
Thanks Man, you are great. I was searching for this from last week.
I have been using your plugins and hacks a lot lately, they are all VERY helpful, thanks!