• Blogging
  • Freebies
  • Freeware
  • How-To
  • Make Money Online
  • Mobile
  • Home >> How-To >> How to Add categories to Nav Bar – WordPress

    How to Add categories to Nav Bar – WordPress

    Arun from BeFolks has asked me a question.

    The question was “How to include categories on the Nav Bar”?

    I thought if i blog the solution, It can also help other readers of this blog.

    If you look at the Header section of this blog, you will see the Nav Bar. It includes pages and also some categories.

    Categories in Nav Bar

    You can see from the above, that i have included following 5 categories along with the some pages:

    Now, the question is how do you do this? It is pretty simple. You need to have some knowledge in WordPress and you should find out in which theme file your Nav Bar code is residing.

    Instructions to Add Categories to Nav Bar

    My theme has nav_menu.php file. This file contains the menu code. I have put the following code in this file:


    I am only including some categories. I have specified the categories that i want to include using “include=3,25,42,11,10” parameter.

    Each Category is assigned with a Category ID. To find the category id, just go to Posts -> Categories and hover over the title of the Category. The status bar of your browser will display a URL with a numeric ID at the end. This is the Category ID. You can see from the below url: 3 is the cat id.


    wp_list_categories generates each category as list <li>..<li/>. It marks the current category with HTML class current-cat.

    For more instructions on wp_list_categories and Styling of Category List, Please check wp list categories page.

    Please leave a suggestion or doubts if any by leaving a comment

    IMPORTANT: This blog welcomes Guest Bloggers, Writers to also contribute by writing Guest Posts and also Make Money!. Check out our Revenue Sharing Program
    1924 readers are already subscribed to this blog! Why don't you be one of them? Subscribe to this blog via your favorite RSS feed reader or by entering your email address on the form below:


    1. thanks Nihar!!! it was really helpful

    2. Lyndi says:

      Interesting. I can see how you got the categories in the menu but you have 2 pages before the categories on the menu with another 2 at the end of the menu. How did you do this?

    3. Nice tip Nihar… Another point, using the same mechanism you can exclude pages as well… ie wp_list_categories(“exclude=3”) etc…

    4. TechnoSamrat says:

      Nice tip Nihar… Until now I was manually adding the categories using lists…. Now I’ll try this..Thanks

    5. Read 2 Know says:

      This is kewl. I’s thinking of asking you the same question. I though I first need to create a page and manipulate things there…

      This is much simpler than I thought.

      You knw what, I thought of posting this question in a forum! 🙂

    6. Atniz says:

      I just add some plugins to my blog. It took nearly 2 hours. This looks good but I’m going to save it for my next update.

    7. Nice trick Nihar, there is a plug in sucker fish multi-navigation plug in. Which allows to add categories, pages and archives easily and also as a drop down menu.

    8. ralph says:

      How would I eliminate the “Categories” label when inserting the category names into my main nav menu

    9. Riley says:

      Great post Nihar, I figured it out because of you! 😉

      Is &amp supposed to be in the code above?

    Leave a Reply

    page counter
    NiharsWorld on Twitter NiharsWorld on Facebook NiharsWorld RSS Feed