I was wondering if there is anyway to only show pages in the navbar only in the subpages and not on the main page?
I was wondering if there is anyway to only show pages in the navbar only in the subpages and not on the main page?
If I understand it correctly, you only want to show subpages while you're on a subpage. And yes, that's possible.
<?php if($post->post_parent) { // You are on a subpage
// your code here
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&depth=1&sort_column=menu_order&echo=0");
} else { // you are not on a subpage
// your code here
}
?>if your nav is in your header you can create a " header2 " template with the new nav bar of your choice, or without the nav bar.
to do that you go to single.php, page.php, etc. wherever your subs are ( depends on your theme )
the original looks like this...
<?php get_header(); ?>
change to this...
<?php include (TEMPLATEPATH . '/header2.php'); ?>
sorry I didnt explain properly, I only want the pages navigation to appear when your on a page and not on the homepage where all the blog posts appear, is this possible?
Well, yeah. Use the is_home() or is_front_page() function for it.
## would be something like:
if ( !is_home() ) { // page isn't home }
This topic has been closed to new replies.