How to Organize Your WordPress Blogroll Links?


Many WordPress Themes that are released usually come with the default blogroll codes. With that code you have no control over the organization of the blogroll links in your sidebar. By default it is all organized alphabetically, but in this article we will show you how you can control how your blogroll is displayed.

Update: Please note that Link Manager was sort of removed in WordPress 3.5. We recommend that you use WordPress menus because they are much more flexible. See details in this article.

The default code looks like the one below:

<?php wp_list_bookmarks(); ?>

The code above will show all links and categorizes them alphabetically. First it will organize the categories you place the links in, and then it will organize the links within the categories. But what if you just want to display a specific category of links.

First you need to make a category in your Links section of the WordPress Admin Panel. Then add links to it. Once you have done that find out the category id.

<?php wp_list_bookmarks(‘title_li=&category=2’); ?>

Change the number 2 to the category id, and you can now sort out your links at different areas of the template if you so desire. Now you can take the code above to the next step where you can add more parameters to actually organize the way links are organized.

There is a parameter called “Orderby” which gives the following options:

  • ‘id’
  • ‘url’
  • ‘name’
  • ‘target’
  • ‘description’
  • ‘owner’ – User who added bookmark through bookmarks Manager.
  • ‘rating’
  • ‘updated’
  • ‘rel’ – bookmark relationship (XFN).
  • ‘notes’
  • ‘rss’
  • ‘length’ – The length of the bookmark name, shortest to longest.
  • ‘rand’ – Display bookmarks in random order.

So now your code will look like:

<?php wp_list_bookmarks(‘title_li=&category=2&orderby=id’); ?>

In the above code you are telling WordPress to pull links from category 2, arrange them in list format, and to display them in the order which comes first. So link id=1 will be shown first. WordPress by default shows ascending. But you can change the order by making the following changes:

<?php wp_list_bookmarks(‘title_li=&category=2&orderby=id&order=DESC’); ?>

Now you are telling WordPress to show the links in the descending order. There are multiple other ways you can organize your blogroll links in WordPress. Please refer to the WordPress Codex for more instructions.

Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.