• I like this theme but it’s very annoying that all pages, even sub-pages, are listed on the main menu.

Viewing 2 replies - 1 through 2 (of 2 total)
  • If your theme is using the template tag, wp_list_pages(), then use the depth=1 parameter. You’ll probably find that code in your theme’s header.php script.

    Resources:
    Stepping Into Templates
    Template Hierarchy
    Stepping Into Template Tags

    0utsource

    (@0utsource)

    tookyg – I sympathise with your problem.
    The header file just does not contain wp_list_pages()

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

    The reason I approach this is I’m trying to use the EXCLUDE function to hide a page…

    Someone want to point me in the right direction here?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sub-Pages Listed On Main Menu?’ is closed to new replies.