Quick Tip : Replace The Horizontal Page Menu With The Categories in WordPress Navigation Bar

In 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

  1. Open file header.php from your theme folder. Look for
    <?php wp_list_pages('title_li=&depth=1'); ?>
  2. and replace with.
    <?php wp_list_category('title_li=&depth=1'); ?>
  3. 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 :

  1. Again look for
    <?php wp_list_category('title_li=&depth=1'); ?>
  2. Then change with
    <?php wp_list_category('title_li=&depth=1&exclude='); ?>
  3. Save it!
  4. 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.
  5. Enter your category ID in this code, like this
    <?php wp_list_category('title_li=&depth=1&exclude=3'); ?>
  6. 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'); ?>
  7. 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 (+)

  1. Flinn says:

    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.

    • Eko S. says:

      I’m glad it helped…we always try to share from what we know about wordpress.
      Btw concise tips like this will we represent every sunday.
      Hi Flinn, thanks…nice comment, it motivates us
      :)

  2. Nice fill someone in on and this mail helped me alot in my college assignement. Gratefulness you on your information.

  3. Wah bagus bener infonya. Akan kucoba. Thank fo sharing
    Salam

  4. Audrey says:

    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.

  5. gouthami.b says:

    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….

  6. Tiffany says:

    Category didn’t work for me either, but using the plural “categories” did.

  7. gaming blog says:

    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 ?

    • Eko S. says:

      Hi,
      If you want to change the categories with pages, please change

      <?php wp_list_category('title_li=&depth=1'); ?>
      

      with

      <?php wp_list_pages('title_li=&depth=1'); ?>
      

      Hope this helps you

  8. i prefer like use posting in page rather than in post. so, category is not useful here.

  9. 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 this

    I 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′) parameter

    I 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

  10. reza says:

    if you want to show only specific categories, you can use ‘include’ instead ‘exclude’ parameter

  11. 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 is

    i 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.

  12. fever18 says:

    Nice One ! Thanks for sharing.

  13. Merci, c’est nikel ;)

  14. 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 is

    i 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.

  15. ClicNet says:

    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

  1. Appletell reviews CoPilot Live HD for iPad 3G | The Apple Ipad Blog
  2. Quick Tip : Replace The Horizontal Page Menu With The Categories …
  3. Apple-Overload! » Appletell reviews CoPilot Live HD for iPad 3G | The Apple Ipad Blog
  4. Tweets that mention Quick Tip : Replace The Horizontal Page Menu With The Categories in WordPress Navigation Bar | DynamicWP -- Topsy.com
  5. Top Ten Key Usability Issues in Web Design | RoAce's 123 Power System Blog & Marketing Tips!
  6. Exclude Pages or Posts of Certain Categories from WordPress Search Result

Leave a Reply

 

Amazingly Beautiful WordPress Themes