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.

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:
wp_list_categories('orderby=name&include=3,25,42,11,10&title_li=');
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.
http://www.yourdomain.com/wp-admin/categories.php?action=edit&cat_ID=3
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
thanks Nihar!!! it was really helpful
Arun | BE Folkss last blog post..Steps in creating your domain and choosing webhosts
@Arun, I am glad that the post was useful to you. Hope you add the categories to your nav bar.
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?
Lyndis last blog post..Displaying Code in Content
@Lyndi, well i did something similar to adding of categories. I think it would be good if i come up with one more post
Nice tip Nihar… Another point, using the same mechanism you can exclude pages as well… ie wp_list_categories(“exclude=3″) etc…
@Ajith, yes you are right. This is the reason, i have mentioned wordpres wp_list_categories link to refer in more detail
Nice tip Nihar… Until now I was manually adding the categories using lists…. Now I’ll try this..Thanks
TechnoSamrats last blog post..Upgrade Your Nokia E71 Euro Firmware to v200.21.118
@TechnoSamrat, Give it a try. If you face any probems or have doubts. Let me know.
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!
Read 2 Knows last blog post..New bug found in Browsers – Berth of In-session Phishing
@Arun, Great that you got your answer before asking someone
Nihar, I’m not able to locate the file nav_menu.php. I use the same theme. Do I need to create one? If so, how do I integrate with the pages?
Read 2 Knows last blog post..New bug found in Browsers – Berth of In-session Phishing
@Arun, i created nav_menu.php because, i want to use them at different files. like a programming language function.
In your them directory create nav_menu.php and then just put all the menu code. and then include nav_menu.php in different files. For ex: do below in header.php
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.
Atnizs last blog post..What To Sell On Your Blog?
@Atniz, This is not a plugin.. this is just tinkering of your theme code to get categories to the nav bar.
[...] days back, I shared a wordpress trick on How to Add categories to Nav Bar. Today, i wan to share one more WordPress [...]
[...] How to Add categories to Nav Bar [...]
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.
@Nicholas, Thanks for your information. I will check that out!
[...] How to Add categories to Nav Bar [...]
[...] How to Add categories to Nav Bar in WordPress – [...]
Thanks for your information
[...] How to Add categories to Nav Bar [...]
How would I eliminate the “Categories” label when inserting the category names into my main nav menu
@Ralph, I didn’t get you. Can you give me some example or show the website or code that you used. I will then be able to help you.