GetSocial

  • Blogging
  • Freebies
  • Freeware
  • How-To
  • Make Money Online
  • Mobile



  • How to Add WordPress pages to Nav Bar





    Click here for Trend Micro Titanium Internet Security 2012 Download Free 1 year Valid License Key

    Click here for BitDefender Internet Security 2012 Free 1 year License

    Click here to Download Norton Antivirus (NAV) 2012 Beta

    Click here to Download Kaspersky Anti-Virus 2012 and Kaspersky Internet Security 2012 for FREE

    Few days back, I shared a wordpress trick on How to Add categories to Nav Bar. Today, i wan to share one more WordPress Trick.

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

    niharsworld categories in nav bar 520x28 How to Add Wordpress pages to Nav Bar


    You can see from the above, that i have included following 3 pages along with the some categories. Also notice that they are not one after the other in serial order:

    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 Pages 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:

    <?php wp_list_pages('include=9&title_li='); ?>
    <?php wp_list_categories('orderby=name&include=3,25,42,11,10&title_li='); ?>
    <?php wp_list_pages('include=225,23&sort_column=menu_order&title_li='); ?>

    You can see from the above code, I have am making two calls to wp_list_pages function and in between wp_list_categories. This is the reason you see the pages and categories are mixed in the Nav Bar.

    I have specified the pages that i want to include using “include=225,23″ parameter.

    Each Page is assigned with a Page ID. To find the Page ID, just go to Pages -> Edit and hover over the title of any Page. The status bar of your browser will display a URL with a numeric ID at the end. This is the Post ID. You can see from the below url: 23 is the Page ID.

    http://www.niharsworld.com/wp-admin/page.php?action=edit&post=23

    One important thing to notice about wp_list_pages function is that the Pages are sorted alphabetically by Page title. But, if you want them to be in another order then use sort_column=menu_order parameter.

    For each Page, you can assign the Page Order from Write > Page administrative panel.

    For ex: If I want Contact me to appear at the end. I will assign a higher number to Contact Me than other two pages I am displaying.

    niharsworld categories in nav bar 520x28 How to Add Wordpress pages to Nav Bar

    wp_list_pages function generates each page as list <li>..<li/>. It marks the current Page with HTML class current_page_item.

    For more instructions on wp_list_pages and Styling of Category List, Please check wp list pages.

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

    Technorati Tags: , How-To, , , ,

    IMPORTANT: This blog welcomes Guest Bloggers, Writers to also contribute by writing Guest Posts and also Make Money!. Check out our Revenue Sharing Program

    For Further Reading:

    1. How to Add categories to Nav Bar
    2. How to add Comment Link in Single Post – Wordpress
    3. How to implement Threaded Comments in Wordpress Themes
    4. Hide Google+ Notification from Google Bar [ How-To ]
    5. How to Video / Voice Chat on Nexus S from Google Talk
    6. How to Change User Account Picture Tile in Windows 8 Taskbar
    7. How to Install Windows 8 on USB Drive with Portable Workspace Feature [ FULL GUIDE ]
    8. How to Get the Status Bar in Firefox 4
    Posted under: Freebies, How-To, Webmasters, Wordpress
    2049 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:








    13 Comments

    1. Lyndi says:

      In your last post on this subject I was wondering how you managed to combine the pages with the categories, now I know, thanks.

      Lyndis last blog post..Free WordPress Themes and their users

    2. Atniz says:

      I’m not aware of it. Now, I know what to do to combine my category pages to the main menus. Is it works for drop down menus?

      Atnizs last blog post..The Problem Working At Home

    3. Read 2 Know says:

      Ah! This is waht I was waiting for. I will now change my Navigation Bar. Thnx mama! :)

      Read 2 Knows last blog post..Live Streaming links of Swearing-In of Barack Obama

    4. TechZoomIn says:

      Adding categories is great nihar..I searched for this longback and left without luck.

      Thanks dude for this useful info.

      TechZoomIns last blog post..5 Simple

    5. Roger says:

      Thanks a lot Nihar for this useful tip. I was looking for this information for a long time.

    6. I hope we can be get good advantage with the help of this tip.

    7. Nihar says:

      @Toronto personal injury, I am happy that this tip helped you.

    Leave a Reply

    CommentLuv badge

    Notify me of followup comments via e-mail. You can also subscribe without commenting.

    page counter
    NiharsWorld on Twitter NiharsWorld on Facebook NiharsWorld RSS Feed