WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to "hide" pages from the nav in NEW wordpress 2.7.1 (11 posts)

  1. sasuke781
    Member
    Posted 5 years ago #

    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. >.<

  2. esmi
    Forum Moderator
    Posted 5 years ago #

    http://codex.wordpress.org/Template_Tags/wp_list_pages

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

  3. sasuke781
    Member
    Posted 5 years ago #

    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;
     }
    ?>
    <ul>
    <?php
    
    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();?>
    </ul>
    
    <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

  4. Samuel B
    moderator
    Posted 5 years ago #

  5. sasuke781
    Member
    Posted 5 years ago #

    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

  6. Samuel B
    moderator
    Posted 5 years ago #

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

  7. sasuke781
    Member
    Posted 5 years ago #

    http://www.dailyblogtips.com/wordpress-themes/Vistalicious/

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

  8. AldebaranJill
    Member
    Posted 5 years ago #

    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.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    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.

  10. sasuke781
    Member
    Posted 5 years ago #

    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.

  11. Samuel B
    moderator
    Posted 5 years ago #

    you can execute php in posts and pages
    http://wordpress.org/extend/plugins/exec-php/

Topic Closed

This topic has been closed to new replies.

About this Topic