Forums

Subpages and Navigation (5 posts)

  1. Ferghal
    Member
    Posted 3 years ago #

    I was wondering if there is anyway to only show pages in the navbar only in the subpages and not on the main page?

  2. Hiranthi
    Member
    Posted 3 years ago #

    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
    }
    ?>
  3. ronchicago
    Member
    Posted 3 years ago #

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

  4. Ferghal
    Member
    Posted 3 years ago #

    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?

  5. Hiranthi
    Member
    Posted 3 years ago #

    Well, yeah. Use the is_home() or is_front_page() function for it.

    ## would be something like:
    if ( !is_home() ) { // page isn't home }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.