Quick Tip : Replace The Horizontal Page Menu With The Categories in WordPress Navigation Bar
30th May 2010 | Posted by Eko S. | 26 CommentsIn some wordpress theme, usually the category navigation menu often we get on the sidebar, but I think the position of the category navigation menu on the header section will be more beneficial, because it helps the reader to further explore our site content.
This of course also be beneficial for our site owners, because readers will be more comfortable for long, and this will make pageviews / impressions page of our site will increase.
Then these statistics we can offer to advertisers in order to put an ad on our site. Interested
But we will not display all the categories, because it will make a very tidy. In this article, also described a simple way to exclude categories from the navigation menu.
If you want to exclude the pages from the navigation menu, please see our previous article.
How To?
Step 1. Change the header.php file
- Open file header.php from your theme folder. Look for
<?php wp_list_pages('title_li=&depth=1'); ?>
- and replace with.
<?php wp_list_category('title_li=&depth=1'); ?>
- Save it! This step will replace your pages with categories on menu navigation bar
Step 2. Exclude the categories
Do not show all the categories in the navigation menu, only display categories that you think would be useful to readers. Here are the steps :
- Again look for
<?php wp_list_category('title_li=&depth=1'); ?>
- Then change with
<?php wp_list_category('title_li=&depth=1&exclude='); ?>
- Save it!
- Next, find the category IDs. You can choose one of the following ways :
Manually
Go to Posts > Categories in your WordPress admin panel. Hover one of your categories. As you can see in this picture below our ID is 3 (for example).
Use the plugin
Or the other method, you can use this plugin. You’ll see ID of the categories automatically. - Enter your category ID in this code, like this
<?php wp_list_category('title_li=&depth=1&exclude=3'); ?>
- For exclude more than one category, use comma between the category IDs.
<?php wp_list_category('title_li=&depth=1&exclude=3,10,12,146'); ?>
- Save it! It’s done
I hope this tip useful! If you have any questions, concerns, suggestions, or comments, please do not hesitate to let me know.
20 Comments to “Quick Tip : Replace The Horizontal Page Menu With The Categories in WordPress Navigation Bar”
Add Comments (+)-
-
Nice fill someone in on and this mail helped me alot in my college assignement. Gratefulness you on your information.
-
Wah bagus bener infonya. Akan kucoba. Thank fo sharing
Salam -
Hey Eko nice tut their for non coders,and something that people usually do not consider to write bout these days ,as most of us use highly configurable themes or are coders.
-
Thanks a lot.You saved lot of my time.But step 1 doesn’t work in my theme.After replacing category with categories it’s working….
-
Category didn’t work for me either, but using the plural “categories” did.
-
hey thanx a lot buddy ,can u also tell me how to add pages on the top ,now that i have replaced categories (category dint work for me ,thanx to gautham.b) but now i want the pages to appear above fold ,any tip ?
-
i prefer like use posting in page rather than in post. so, category is not useful here.
-
This is really nice code and i need some help regarding my question
I tried the exclude in wp_list_categories
but my requirement is i add new categories in admin each day and i can not exclude all categories. so is there a solution of thisI want to show few categories in header dropdown(as i have so many categories and all can not be shown in header)
i want to use
wp_list_categories(‘orderby=name&title_li=&child_of=328′) parameterI want when new category is added in admin under that category then it must start showing in front end automatically.
Do you have solution for this.
Thanks
Vaseem Ansari -
if reza replied to me, then this is not what exactly i am looking for.
i have tried every parameter in wp_list_categories
but nothing worked
What i want isi want to show only few selected categories and some few selected pages in header here
http://www.TodaysBollywood.com
If u have solution then plz let me know. -
Nice One ! Thanks for sharing.
-
Merci, c’est nikel
-
if reza replied to me, then this is not what exactly i am looking for.
i have tried every parameter in wp_list_categories
but nothing worked
What i want isi want to show only few selected categories and some few selected pages in header here
http://no1results.com/updates
If u have solution then plz let me know. -
Hello,
how do i put the categories in the horizontal? ( the pages were in horizontal)
mine came all one over the other as a list…. help
thanks a lot
Trackbacks/Pingbacks
- Appletell reviews CoPilot Live HD for iPad 3G | The Apple Ipad Blog
- Quick Tip : Replace The Horizontal Page Menu With The Categories …
- Apple-Overload! » Appletell reviews CoPilot Live HD for iPad 3G | The Apple Ipad Blog
- Tweets that mention Quick Tip : Replace The Horizontal Page Menu With The Categories in WordPress Navigation Bar | DynamicWP -- Topsy.com
- Top Ten Key Usability Issues in Web Design | RoAce's 123 Power System Blog & Marketing Tips!
- Exclude Pages or Posts of Certain Categories from WordPress Search Result
Hey Eko nice tut their for non coders,and something that people usually do not consider to write bout these days ,as most of us use highly configurable themes or are coders.