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()' ?>


<?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.

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching WPHacks.com as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. DeFries says:

    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? 🙂

  2. Kyle Eslick says:

    @ 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.

  3. DeFries says:

    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.

  4. Carlos Carreño says:

    Thanks, your example help me a lot.

  5. Jo says:

    Thanks! Your code was a big help. =)

  6. Omar says:

    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…..

  7. Mike says:

    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!

  8. Ami Chopine says:

    Thank you so much!

  9. ORiOn says:

    How can i hide the title?


  10. ORiOn says:

    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:

  11. pero says:

    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?

  12. Kyle Eslick says:

    @ Pero – I would recommend using WordPress conditional tags, then place the blogroll code into the conditional tags.

  13. Mark McWilliams says:

    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!)


  14. Kyle Eslick says:

    @ 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.

  15. pero says:

    i solve problem with this:

  16. Mark McWilliams says:

    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!… 😀


  17. TMR says:

    Awesome! Thank you for posting this!

  18. sterndal says:

    hi! this post has been very helpful to me. I’ve just started a self-hosted blog and this article helped much. thank you!

  19. Pattaya Guides says:

    Thank at all, but I need to show link with description anybody can help me.


  20. Adal Design! says:

    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.

  21. Cdinsky says:

    Very nice. Configurable code, that is.

    Thanx : )

  22. stephanie says:

    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!!

  23. Livio says:

    Thanks for the code, i was looking for it.

  24. gagandeep says:

    Thanks Man, you are great. I was searching for this from last week.

  25. 1stblogger says:

    I have been using your plugins and hacks a lot lately, they are all VERY helpful, thanks!

Trackbacks/Pingbacks »

  1. MT 4.1 vs. WordPress at Pocagoolie says:
  2. Wordpress Plugin Centre - Wordpress trick - WordPress Themes Tips and Tricks says:
  3. Top 30 Most Wanted Wordpress Tricks and Hacks | Make Money Blogging Experiment says:
  4. 100+ Killer Wordpress Resources | Steffan Antonas' Blog says: