Forum Replies Created

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter Pookster

    (@pookster)

    Let me give you an example of what I’m trying to achieve.

    • I have 5 mainpages (1 to 5)
    • Page 3 has two children (3.1 and 3.2)
    • Child 3.1 also has two children (3.1.1 and 3.1.2)

    I only want to see the children 3.1 and 3.2 when their parent is active. So, only see children when the parent is active. But, when I’m on a childpage 3.1 or 3.2, the parents still need to be visible (1 to 5).

    The same for the children of the children. I only want to see 3.1.1 and 3.1.2 when page 3.1 is active. But, when I’m on page 3.1.1 or 3.1.2 all parents need to be visible ( page 1 to 5 and page 3.1 and 3.2)

    And I realy would like to have alle three levels (3, 3.1 and 3.1.1) in separate ul’s).

    I just can’t get it to work. Hopefully it’s clear what I want.

    Thread Starter Pookster

    (@pookster)

    I´ve tried that code and it got me in, sort of, the right directions. This is de code I have so far

    <ul class="span-24" id="nav">
    			<?php wp_list_pages('title_li=&depth=1&exclude=18,20'); ?>
    		</ul>
    
    		<?php
    			if(!$post->post_parent){
    				// will display the subpages of this top level page
    				$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    			}else{
    				// diplays only the subpages of parent level
    				//$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    
    				if($post->ancestors)
    				{
    					// now you can get the the top ID of this page
    					// wp is putting the ids DESC, thats why the top level ID is the last one
    					$ancestors = end($post->ancestors);
    					$children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");
    					// you will always get the whole subpages list
    				}
    			}
    			if ($children) { ?>
    				<ul class="span-24" id="subnav">
    					<?php echo $children; ?>
    				</ul>
    
    		<?php } ?>

    As you can see, the parent en child pages are in separate ul´s. I now would like the third level also in a separate ul. Right now it´s nested under the second level page. Can´t figure out how. Do you have any suggestions.

    Thread Starter Pookster

    (@pookster)

    Thnx man! I’ve been testing this around but still can’t get it to work. I’m not sure where to put the entire code. Do I have to put the code for listing the sub pages (depth 2) in the custom template or can I put the entire code in the header.

    I’ve played with both. The problem I’ve been experiencing is that the childpages (with children) disappear as soon as I click on one of its childeren.

    Page 1
    child 1.1
    grandchild 1.1.1
    When on the grandchild page, all items need to be on the screen. No when I’m on the child page and click on grandchild 1.1.1, the page-links of child 1.1 disappears.

    Thread Starter Pookster

    (@pookster)

    Anyone?

Viewing 4 replies - 16 through 19 (of 19 total)