A lot of WordPress Themes that are being released usually come with their own default blogroll codes. With this, the code you have no control over the organization of the blogroll links in your site sidebar. By default, your blogroll is all organized alphabetically, but in this post, we’ll show you how to get your right to control how your own blogroll is displayed back, again and again, rearrange links in your blogroll.

How to Rearrange Links in WordPress Blogroll

The default code looks like the one below:

<?php wp_list_bookmarks(); ?> 

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

Firstly, 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. 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’ – Users adding bookmarks through the Bookmarks Manager.
  • ‘rating’
  • ‘updated’
  • ‘rel’ – bookmark relationship (XFN).
  • ‘notes’
  • ‘rss’
  • ‘length’ – The length of the bookmark name, from the shortest to the longest.
  • ‘rand’ – Display bookmarks in random order.
Also Read  How to Move WordPress to a New Host or Server With No Downtime

So your code will now look like this:

<?php wp_list_bookmarks('title_li=&category=4&orderby=id'); ?> 

In the above-written codes, you are telling WordPress to pull links from category 4, arrange all of them in a listing format, and also to display them in the order of 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 at which you can organize your all your blogroll links easily in WordPress. Please refer to the WordPress Codex for more instructions.

Read: How to re-arrange comments in WordPress

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

CMSFolks Editorial Crew

Editorial Staff at CMSFolks is a team of WordPress experts led by Ajayi Adekunle. Site maintained by CMSFolks Studio.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu

Spelling error report

The following text will be sent to our editors: