WordPress.org

Ready to get started?Download WordPress

Forums

Hiding pages from nav bar (5 posts)

  1. cganz
    Member
    Posted 4 years ago #

    I have a template with a navbar built in. When I create a page it adds that page to the navbar as either a parent or a sub-parent.

    I have several pages that I need to allow access to for visitors so I can't make them private. If I make them public they show up on the navbar. If I leave the title blank it just places a blank button the navbar.

    Anyone have a way of hiding a page from the navbar without making it private?

    Thanks

  2. Jabbok
    Member
    Posted 4 years ago #

    In the theme I'm using I had to add an "exclude" statement to the header.php

    Here is what it looks like:

    <li><a href="<?php echo get_option('home'); ?>/" class="on">Home</a></li>
      <?php wp_list_pages('exclude=2,14,76,106,253,290,372&title_li='); ?>
  3. poodyglitz
    Member
    Posted 4 years ago #

    I want to do the same thing. In my "header.php", here's what the code looks like:

    <div id="navbarleft">
    <ul id="nav">

  4. " class="style1">Home
  5. <?php wp_list_pages('title_li=&depth=4&sort_column=menu_order'); ?>

    How do I add the exclude in order to make it work?

    Thanks.

  • There's also a Exclude Pages from menus and navigation plugin that I've used in the past and it works well. No code or template editing necessary.

  • markhawkins
    Member
    Posted 3 years ago #

    Brill was looking for exactly that - Exclude Pages, fantastic!!!

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags