WordPress.org

Forums

hide siblings link of grandchild on grandchild page (1 post)

  1. salihkulangara
    Member
    Posted 2 years ago #

    Hi Folks,
    I Know the Title is a little bit confusing, i'll explain it. My site structure is something like this
    page-1
    page-1-1
    page-1-1-1
    page-1-1-2
    page-2
    page-2-2
    page-3

    when i am on a page it will show its child pages as links
    eg:- when i'm on page-1 it shows
    page-1
    page-1-1
    page-1-2
    page-2

    like that. if i go to page-1-1 if that page has child pages(grand child of page-1), i dont want to show the page's grand child page links, instead i wnat to show as the child page's links
    eg; if im on page-1-1-1
    i want the navigation like this
    page-1
    page-1-1
    ok,
    but my current code will show all links like this
    if im on page-1-1-1 navigation bar look like this
    page-1
    page-1-1-1
    page-1-1-2
    page-1-1-3
    i only want page-1-1 even if we are on page-1-1-1
    my curent code is like this, for design sake i've done like this

    <?php wp_list_pages('title_li=&depth=1&exclude=50,54,52&post_type=page'); ?>

    for sub menus

    <?php
    if($post->post_parent){
    $children = wp_list_pages("title_li=&depth=1&child_of=".$post->post_parent."&echo=0");
    }else {
    $children = wp_list_pages("title_li=&depth=1&child_of=".$post->ID."&echo=0");
    }if ($children) { ?>
    <div class="subMenu">

      <?php echo $children; ?>

    </div>

    <?php }
    ?>

    Hope a Helping hand ASAP, Thank you

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by salihkulangara
  • This topic is not resolved
  • WordPress version: 3.4.1