Disclaimer: I have no idea what I’m doing when it comes to WordPress development. But I’ve got 4 WordPress blogs (all hosted on DigitalOcean, by the way) and it seems I should know something about this. So every now and then I do something that I think is interesting. This is one of those things. I don’t claim it’s a good idea, but in case it is, I’m telling you how I did it. :)
Cleaning Up A Design
So I decided to chop all the side bars out and greatly simplify / clean up the episode pages. I’m glad I did. The end result looks soooooo much better now – super clean.
But after doing this cleanup, I realized that I still wanted a way to show all of the episode categories. This makes it easier for people to find more episodes about subjects they are interested in.
Listing Categories On A Page
After a bit of digging around, and asking on twitter, it was suggested that I use the “wp_list_categories” function:
— Eric Fuller (@ericpfuller) June 23, 2014
As it turns out, this is exactly what I needed. But I thought I was going to have to build a custom page template and do all kinds of crazy WordPress things that I have no clue about. Then a little bit later, I realized that I don’t need to do this. I can just add a custom short code and have that short code call this function for me! So I did. And here’s that short code registration / function (all in my functions.php file):
With this in place, I added a new page to my site and just typed in the “show_categories” shortcode and BAMN! Done! WatchMeCode.net now has a nice big list of all the categories, and with a bit of CSS styling, I turned it in to a good looking page where it’s pretty easy to find the categories you’re looking for.
I also added an “Episode Categories” link to the menu so you can easily get to this page. Done.
I’m definitely liking WordPress for my blogs and and sites, still. Things like this may seem a bit obtuse or strange to people (like me) that usually write their own code for this stuff… but I’m ok with that, since it lets me focus on the task of producing content (screencasts and blog posts) instead of producing the website.