It`s simple when you know how ! Tutorials Simple way to add horizontal categories menu in WordPress without CSS

Simple way to add horizontal categories menu in WordPress without CSS

 

To create a horizontal categories menu separated by ‘ | ‘ in WordPress, use this code.

<?php
echo str_replace('<br />',' | ',
wp_list_categories('style=&echo=0&title_li='));
?>

If you want to exclude category from the menu then add this code, Example to exclude category with id=2 :

<pre><code>wp_list_categories('style=&echo=0&title_li=&exclude=2');</code></pre>

To find the category id,
1. go to Posts > Categories.
2. Hover to any category name, and look at your browser status bar. Look for something like `…&tag_ID=2…`. In this case, the category id is 2.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post