• What I am wanting to do with my site will require me to create many different pages, but I am wanting to link to these pages within a page (that will be a tab on the top bar). Every time I publish a new page it automatically creates a tab for the page on the top of the site.

    I have tried to work around this by linking to the unpublished page, which seemed to work for me on Firefox browser, but on internet explorer it says cannot be found.

    Can anybody tell me what I need to do in order to keep new pages from being put as a tab? The site is All-Notions.com if the source code may help.

Viewing 12 replies - 1 through 12 (of 12 total)
  • hi

    when you are editing a page, to the right under Publish Status (2.5 and up) you will see a check box “Keep this page private”. Check it and save (or publish if it is new) your page. That will keep it off the menu, yet you can still link to its URL on your pages.

    But then the pages don’t show up, unless one is logged in. So that’s not working for me. Any other suggestions?

    You want to read this article:
    http://codex.wordpress.org/wp_list_pages
    specifically Point 3.5 “Exclude Pages from a List”

    Thread Starter ghanes14

    (@ghanes14)

    Yeah the “Keep this page private” option requires people to log in when I do it as well.

    Amy I looked at the link, and I was wondering if you (or anyone else who reads this) can tell me where I am supposed to put the piece of code in? It doesn’t say where it goes, would it be in top of each new page, in the header.php file or what?

    Thread Starter ghanes14

    (@ghanes14)

    No body knows?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    ghanes14: All you have to do is edit your theme and find the wp_list_pages command, then add the exclude bit to it. Like AmyCelona said, basically.

    We can’t tell you where it is in your theme, because we cannot see your theme and we do not yet have the power of all-knowing knowing-allness. 😉

    Thread Starter ghanes14

    (@ghanes14)

    Haha, she didn’t say as to where to find the code to change, just provided the link. I think I found the piece of code, just now having problems figuring out where to insert the exclude code.

    I have been adding it in different spots but it doesn’t quite work (just mess’s the tabs up). Some people have helped with coding on past things by viewing the source code so I didn’t know if that could be done here as well.

    Here’s the bit of code that seems to mess up tabs when I play with it, if someone could place the exclude code to it in bold that would be helpful :P.

    Exclude code:

      <?php wp_list_pages(‘exclude=17,38’ ); ?>

    My code:

    <div id=”nav”>
    <?php function get_the_pa_ges() {
    global $wpdb;
    if ( ! $these_pages = wp_cache_get(‘these_pages’, ‘pages’) ) {
    $these_pages = $wpdb->get_results(‘select ID, post_title from ‘. $wpdb->posts .’ where post_status = “publish” and post_type = “page” order by ID’);

    }
    return $these_pages;
    }

    function list_all_pages(){

    $all_pages = get_the_pa_ges ();
    foreach ($all_pages as $thats_all){
    $the_page_id = $thats_all->ID;

    if (is_page($the_page_id)) {
    $addclass = ‘ class=”current_page”‘;
    } else {
    $addclass = ”;
    }
    $output .= ‘<li’ . $addclass . ‘>ID).'” title=”‘.$thats_all->post_title.'”><span>’.$thats_all->post_title.'</span>‘;
    }

    return $output;
    }
    ?>

      <?php

      if (is_home()) {
      $addclass = ‘ class=”current_page”‘;
      } else {
      $addclass = ”;
      }
      echo “<li” . $addclass . “><span>Home</span>“;
      echo list_all_pages();?>

    <div class=”cleared”></div>
    </div> <!– Closes Nav –>

    Thread Starter ghanes14

    (@ghanes14)

    Did providing the code help anybody? Problem is the only programming language I am used to is HTML, maybe a little CSS, but not PHP at all.

    That’s a lot of code… I know that my ‘list pages’ was in the header.php document because the page listing shows up in the header.

    The code given was:
    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li= ' ); ?>

    and I changed it to exclude the pages, so it looks like this:

    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li= exclude=185,328' ); ?>

    However it still does not exclude the pages. I am the blind leading the blind, but all that code is from which document?

    Thread Starter ghanes14

    (@ghanes14)

    Haha, that was just one section of the header.php file…

    If that code would work where I just exclude the page number it would have saved me so much trouble, and trouble in the future *rolls eyes*. I had to work around this manually and create each tab image myself, which took so much editing to get right. Then I just erased all the “nav” code up there and put in the <img src> and code for each tab and page.

    Sorry to hear the code didn’t work for you, if your still having problems maybe you can do it the way I did? Lots of trouble and takes up more time, but I guess its been working.

    Thanks for the reply. 🙂

    If you’re having trouble editing the code, then you might be better off installing this plugin.

    With the plugin, you just have to uncheck a box in the Manage > Page screen, save, and the page will be excluded from your menu.

    Tim

    Thread Starter ghanes14

    (@ghanes14)

    0.o whoops, um supposed to say (image code) and (link code), this is what happens when you jump out of bed and get on the computer before waking up, haha.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to stop a new page from being a tab on the top bar?’ is closed to new replies.