• Resolved josh_fester

    (@josh_fester)


    I want to exclude a page from showing up in my navigation links in the header. I’ve seen examples using wp_list_pages, but my header.php doesn’t use that. here’s what i have:


    <?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>';
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • $these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "publish" and post_type = "page" and ID <> 123 order by ID');

    note that I added and ID <> 123

    Thread Starter josh_fester

    (@josh_fester)

    Thank heavens! I made it ID < 140. The page I want hidden is 160. It works! Thank you so much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to hide page from navigation’ is closed to new replies.