WordPress.org

Ready to get started?Download WordPress

Forums

Pages in Header Help (3 posts)

  1. khaledeomar
    Member
    Posted 5 years ago #

    On my blog the header will continue to add each page that I create.

    The Code:

    <div class="primarynav">
    <ul>
    <li class="first">
    <a class="<? echo (is_home())?'current_page_item':'off'; ?>" href="<?php echo get_option('home'); ?>/">Home</a></li>
    <?php $pages = wp_list_pages('title_li=0'); ?>
    </ul>
    </div>

    If you go to my blog: KnockedOutBlog you will see that it says advertise on the top. That's a page that I don't want in the header, how would I go about keeping the About Us and Home but removing advertisements.

  2. auxano
    Member
    Posted 5 years ago #

    A really simple way is to use a plugin that allows you to select whether or not a page gets included in the navigation.

    http://wordpress.org/extend/plugins/exclude-pages/

  3. esmi
    Forum Moderator
    Posted 5 years ago #

    First go into Admin/Pages and find the Advertise page. Place your cursor over the page title in the list and look in your browser status bar. You'll see a url that ends with something like post=123. That number is the id of the Advertise page. Armed with the page id, you can now exclude it from your menu by using:

    <?php $pages = wp_list_pages('title_li=&exclude=advertise_page_id'); ?>

    replacing 'advertise_page_id' with the appropriate number.

Topic Closed

This topic has been closed to new replies.

About this Topic