Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Organize Your WordPress Blogroll Links?

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
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.


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Rasheed says:

    Hey, I am trying to edit my links widget to order by id number but I cant find where exactly in my files to edit the links widget so I can add the piece of code needed. I hope I explained this correctly. If you could help I would greatly appreciate it.

    • Editorial Staff says:

      You need to download the plugin by Justin Tadlock called Widgets Reloaded. That would help.

  2. dotku says:

    It doesn’t work for version 3.0.1

  3. allen says:

    how do you make it so the category name can be formmated properly. my wordpress theme somehow adds an tag around the category name and it is HUMONGOUS next to the links that are below it.

    please does anyone know how to reduce the size of the category name? I am using WordPress Gear theme.

  4. Aaron says:

    How do you get the link description to show up with the link?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.