Show a Particular Categories and its Sub-categories on Sidebar

I’m not going to suggest a plugin. Just some simple code to put on your sidebar.php

Let’s say,  on your sidebar, you want to show only a particular category and its sub-categories but when you try to use widget, it does not let you choose which mother category you can set it to.

Here’s a simple example:

“Movies” is our mother category and the others on the list are sub-categories with post count.


<?php wp_list_categories('orderby=name&show_count=1&child_of=3&title_li=<h2>Movies</h2>'); ?>

You may refer to TEMPLATE TAGS /WP LIST CATEGORIES for a list of options how you want your category list to appear.
But then it’s up to you to know how or where to paste it on your sidebar. 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s