Jan 09

Don’t get me wrong, WordPress is a great tool. But sometimes there’s something I want to do that just doesn’t exist in the default installation. Case in point: creating the subcategories of links you see on the bottom of the middle column of this page.

So this is what I came up with (after much fruitless Googling). Before trying this though, I would highly suggest that you backup your files, just in case you make a mistake (which I usually tend to do).

I went into the ‘Theme Editor’ and edited sidebar.php. I deleted the ‘get_links_list’ part of the code, and instead added the code in the form below.

First, change what’s in the ‘h2’ tags to change the category name. You’ll then need to change the ‘h4’ tags to change the names of the subcategories. You will then need to make sure the numbers in brackets (3, 4 and 5 in this case) match up to numbers of the categories you’ve set up in the WordPress link categories.

Messy? Quite possibly. Good code? Probably not. Did it work for me? Yes, it did. Hopefully this will help someone who ran into the same frustration with trying to set up subcategories that I did.

Please also note that I am not a professional coder, so if anyone has any suggestions about how to clean up or improve the code that does this, I’m all ears.

Like this post? Subscribe now to the full RSS feed.

Related Posts

Comments are closed.