Wordpress - Creating a random friends blogroll
Posted By Mike on January 28th, 2008
Occasionally I’ll receive an e-mail or a blog comment from someone asking me what plugin I use for my random friends blogroll. The answer to that question is I don’t use one. However I thought I’d go ahead and show how it’s done that way I can just point people in this post’s direction the next time the question is asked. Creating the blogroll is really very simple. It just uses functions that are already built into Wordpress.
First of all one of the things I ALWAYS do when working with the Wordpress sidebar is make sure I use HTML comments so that everything is easy to find later when I feel like doing more editing. If you’re not familiar with HTML comments, they’re simple enough to learn and really do save a lot of time when scanning through long pages looking for code you want to edit. For example here’s the HTML comments I use for my random blogroll:

Now then let’s move on to creating our blogroll, shall we? I really can’t stand long blogroll lists, so I usually like to display between 5 and 8 links randomly, then create another link which points to a separate page listing everyone in my blogroll. First I’ll show you the code I use, then attempt to break it down so that it makes a little sense. Here is what I currently use in my sidebar:

Okay now that you see what it looks like, let’s find out what that all means. Actually the first and last numbers which I have bolded in red are really the most important, so I’ll concentrate on those. The first number (in this case 16) represents the category ID number for your blogroll. For example if you have a category named “friends” which acts as your blogroll, you’ll need to use the ID of that category, in place of my number 16. Finding the category ID number is easy. Login to your Wordpress dashboard and click Blogroll. You should see a table full of your blogroll links. The third column over, called categories, is what you need to focus on.

Mouse over the category name for the blogroll you want to include in your random list. You should see the ID number in the status bar of your browser.

Now plug that number into the code above. Easy, right? Finally the last number, in my example number 5, represents how many links you want to display in your blogroll. If you want to display 10 random links, then change the number to 10. For more detailed instructions outlining what all the parameters in the code I’ve presented mean, you can check out the Wordpress Codex. You’ll see a warning at the top of the page alerting you that the code has been deprecated and may no longer function in future versions of Wordpress, however I’m using the latest version of Wordpress and the code still works just fine for me.
I’ve uploaded a text file including the code above, if you’d rather copy and paste it as opposed to typing it all out yourself. Click here to download it.
Popularity: 12% [?]
Looks like you've never been here before! Today is your lucky day. For just the price of a simple mouse click, you can subscribe to this blog's RSS feed!
Related Posts
Comments
Trackbacks
- Must-See Blog TV | Six 4 Paula
- Une blogroll dynamique!!! at Aurelien Bessaguet | un blog web2.fr
- la Bogroll va tuer les blogs | Le Journal du Blog
- GĂ©rer sa blogroll avec WordPress » daria blogue
- Some Wordpress SEO Thoughts | Stephan Miller



Very nice little tutorial here. I am going to give this a try tomorrow.
Hee hee hee. I think I’ve asked you this question a couple times. I’m sorry I haven’t gotten you the thing you need for the top-secret project, but I’ve been having a wee bit o’ crapola going on LOL. Soon my artist buddy that rocks!
Paula’s last blog post..I Heard a Rumour
This is like math for me, which means that no matter how hard I try I’ll never figure it out, lol. It’s a really cool feature though. Hope you’re having fun making movies buddy:) Have a great day! Hugs.
Christy’s last blog post..Happy 50th Anniversary Lego
@Bose: Thank you! Good luck with it =)
@Paula: Haha…I thought of you while writing this post
Take your time with the thingy! There’s no rush =)
@Christy: HEhe…One thing I’ll definitely never be teaching here is math
It’s always good to hear from ya, Christy. Hope you’re doing well! *hugsback*
Mike, you are just way too good at this!!!
LOL, it’s all just a product of trial and error ;P
Mike, I finally went with a theme that does not use widgets so am having to learn a lot and I finally used this tutorial and I got it working! WHEEE! Thanks buddy.
Paula’s last blog post..Dear Lisa
Wheee, glad to be of service
I’m having a tough time getting your blog to load right now though, so I can check out your new theme 