Need to remove Nav Tabs for Subpages from my theme
-
I’m just starting out and I picked a free Studiopress theme for my site. I’ve customized it to the point that I’m getting close to liking it, except for one issue.
When you add a subpage, it adds a tab to the top level navigation. The market street tab showing on my site is a subpage to “scattered scribbles.” I’ve done some searching but it seems most have the opposite problem: they want the tabs and don’t have it, and the offered solutions don’t match what I’m seeing.
Is it because of the “$all_pages” in the following? What would I replace to make it only grab the top level directory for the top navigation tabs?
Thanks Soooooo Much in advance!!
<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 . ‘>ID).'” title=”‘.$thats_all->post_title.'”><span>’.$thats_all->post_title.'</span>‘;
}
return $output;
}
?>-
<?php
if (is_home()) {
$addclass = ‘ class=”current_page”‘;
} else {
$addclass = ”;
}
echo “<li” . $addclass . “><span>Home</span>“;
echo list_all_pages();?><div class=”cleared”></div>
</div>
- The topic ‘Need to remove Nav Tabs for Subpages from my theme’ is closed to new replies.