Skip to content

WordPress Hacking: Specify Display of Categories

2011 May 2
tags: ,
by Tedb0t

The theme I’m using (Vigilance) doesn’t have a control in its settings for which categories to display in the header.  I discovered it’s extremely easy to do it yourself in the code editor.

Look for this bit of code towards the end of the Header Template:

<?php if ($vigilance->hideCategories() != 'true' ) : ?>
	<?php wp_list_categories( 'title_li=&depth=2&include=91,170,9,98,43' ); ?>
<?php endif; ?>

Here I’ve added the “include” parameter, which specify which category IDs to display.  Note that if you specify any child categories, you’ll have to increase the “depth” parameter, and you can’t seem to control the order.  Pretty handy anyway!

Related Posts:

Comments are closed.