How to display child-pages only in the sidebar?
-
Hi @ll,
It’s my first attempt to use WP, thanks in advance for your patience..
My challenge is ‘hiding child-pages from the main-navi and displaying their links in the sidebar’.theme: StudioPress 1.2 (for the nice main-nav)
I tried several plugins but some won’t work or just hide the child-pages in the sidebar – the opposite effect I am looking for.
plugins:
page-link-manager (no effect)
pagemash (update timeout, -“-)
exclude-pages (sidebar only)
flexi-pages ( -“- )
CSS:
.page-item-23 {display: none;} (sidebar only)I read about
<?php wp_list_pages('exclude=23' ); ?>
but either I put it wrong or it doesn’t match with the theme…the nav part of header.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 -->
Any hints? Thx! ??
- The topic ‘How to display child-pages only in the sidebar?’ is closed to new replies.