In this tutorial, i’ll give you the PHP code you can add at the end of your child themes functions.php file which displays a list of your post categories.
You can exclude any category from this list and modify the output using the native WordPress category parameters which are extensive.
Here’s what i’m talking about:
The above screen shot uses the default CSS for the Twenty Twelve nav menu however you can use your own themes existing navigation styling or add your own.
No CSS code is needed to achieve this result.
Simply replace the classes in this line of code with your own themes nav menu classes.
echo'<nav id="site-navigation" class="navigation main-navigation" role="navigation">';
The code enables you to easily exclude categories by adding the i.d to the code and the output will still look good as you can see in this image:
Here’s the PHP code:
The PHP code includes the_content filter so it works with any theme however you can easily modify this to use your own theme specific hooks or another native WordPress action hook or filter.
Here’s what it looks like in the Twenty Fourteen theme using the code below without any tweaking of the classes or adding any CSS:
I grabbed the navigation menu classes from the header.php files
Other themes will require you to modify the classes in the PHP code.