Skip to content


WordPress: that’s how I blogroll

I’m still continuing my WordPress theme education albeit at a plodding pace. For now, I’m still content to modify themes by others to suit my own purposes.

The most recent thing I did was learn how to create a random blogroll. This isn’t something most casual WordPress bloggers will need, I suspect. They’ll probably have 10 links at most on their blogroll and be happy enough to display them all. I, on the other hand, have a blogroll containing a few dozen links on another blog and the thing really is intimidating. It’s a giant wall of links that takes forever to scroll through and overwhelms the reader with too many choices about where to go next.

I decided to make the Giant Blogroll From Hell less terrifying by randomly picking 10 links from it every time it’s called. There are a few ways to accomplish this; I chose to simply use WordPress’s built-in wp_list_bookmarks template tag.

The code to use is:

< ?php wp_list_bookmarks('title_li=&categorize=0&show_description=0&orderby=rand&limit=10'); ?>

In English, that tells WordPress to refer to the blogroll and display 10 random links from it without categorising them. Simple and effective.

But what if someone wanted to check out the full blogroll and experience the infinite mouse wheel scroll of doom for themselves?

The solution was to create a custom WordPress page displaying the entire blogroll. Now the thing is WordPress pages do not execute PHP code (for example, the code needed to call the blogroll) so you first have to create a blogroll page template then create a page using that template. The process is clearly described here.

Posted in WordPress.