Support » Fixing WordPress » How to “hide” pages from the nav in NEW wordpress 2.7.1

  • Resolved sasuke781


    OK i have been all over this site and im very frustrated at this point that this option still isnt a part of wordpress, i have several pages that i DONT want on the nav menu, apparently all the coding was changed in version 2.7.* so i need an updated way to hide these pages. NONE of the plugins that i’ve tried so far have worked, if anyone has a WORKING fix PLEASE post. >.<

Viewing 10 replies - 1 through 10 (of 10 total)
  • esmi


    Forum Moderator

    And I think you’ll find that wp_list_pages has been around since WP 1.5

    then i must have an odd wordpress theme this is my nav menu code from headers.php

    <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 . '><a href="'.get_permalink($thats_all->ID).'" title="'.$thats_all->post_title.'"><span>'.$thats_all->post_title.'</span></a></li>';
    return $output;
    if (is_home()) {
      $addclass = ' class="current_page"';
      } else {
      $addclass = '';
    echo "<li" . $addclass . "><a href='" . get_option('home') . "' title='Home'><span>Home</span></a></li>";
    echo list_all_pages();?>
    <div class="cleared"></div>
    </div> <!-- Closes Nav -->

    i dont have the code you posted, and when i tried to use ‘exclude’ all i got were php errors

    that doesnt work for me, i tried it >.< i’ve tried every plugin and none of them work, thats why im trying to get help with my code, im guessing i’ve got a non-standardly coded theme =P

    must have – I’m using that plugin on 7 differing blogs all 2.7.1 except test site which is 2.8-bleeding


    is my theme, can someone PLEASE help me figure out how to exclude pages >.<

    Have you tried switching to the default theme, just to confirm that the issue is indeed with your theme and not somewhere in your core wordpress files? if samboll says it’s working for him, maybe try to isolate the issue to either the theme or the wordpress install.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    sasuke781: The code you posted is doing its own select query, so no plugin will help you. You need to change it to do things the right way, by using wp_list_pages and/or similar functions. Then those sorts of plugins will work for you.

    no i have not AldebranJill, and Otto42, im probly just going to switch to making custom pages again because a: wordpress wont allow me to put php code into a post/page which screws me severely and kinda stupid imo and b: i’ve had more problems with using wordpress as a cms then its solved, i dont think wordpress is ready for use as a full site, only a blog, seeing as how hiding pages isnt an integrated part of wordpress considering how many people do it, another opinion is that wordpress should allow ONLY one type of standard theme coding and ill rant at the idiot who made the theme later for making this 3 times harder then it should be, just some thoughts here for the dev’s to consider.

    you can execute php in posts and pages

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How to “hide” pages from the nav in NEW wordpress 2.7.1’ is closed to new replies.