WordPress.org

Ready to get started?Download WordPress

Forums

Listing subpages & subsubpages / children & grandchildren (4 posts)

  1. jellway
    Member
    Posted 5 years ago #

    Hi all,

    I have a theme with 3 levels of page navigation.

    I have the following principle working with 2 levels...

    - If your on a PARENT page with NO CHILDREN then only the PARENT list of pages appears.
    - If your on a PARENT page WITH CHILDREN then the PARENT + CHILDREN lists of pages appear.
    - If your on a CHILD page then the PARENT + CHILDREN lists of pages appear.

    This is working with this code...

    <div id="sidebar">	                                
    
    	<div id="menu_level_1">
    		<ul>
    			<?php wp_list_pages('sort_column=menu_order&title_li=&depth=1&exclude=93'); ?>
    		</ul>
    	</div>
    
    	<div id="menu_level_2">
    		<ul>
    			<?php
    				if($post->post_parent)
    				$children = wp_list_pages("sort_column=menu_order&title_li=&depth=1&child_of=".$post->post_parent."&echo=0");
    				else
    				$children = wp_list_pages("sort_column=menu_order&title_li=&depth=1&child_of=".$post->ID."&echo=0");
    				if ($children) { ?>
    				<?php echo $children; ?>
    			<?php } ?>
    		</ul>
    	</div>
    
    	<div id="menu_level_3">	                                
    
    	</div>
    
    </div>

    As per: http://codex.wordpress.org/wp_list_pages#List_subpages_even_if_on_a_subpage

    I want to add a third level...

    - If your on a CHILD page with NO GRANDCHILDREN then the PARENT + CHILDREN lists of pages appear.
    - If your on a CHILD page WITH GRANDCHILDREN then the PARENT + CHILDREN + GRANDCHILDREN lists of pages appear.
    - If your on a GRANDCHILD page then the PARENT + CHILDREN + GRANDCHILDREN lists of pages appear.

    How can I vary this for the third level of navigation?...

    <div id="menu_level_3">	                                
    
    </div>
  2. jellway
    Member
    Posted 5 years ago #

    Anyone?

  3. karl19
    Member
    Posted 5 years ago #

    A bit late, parhaps you've already found a way. But in case someone else stumbles over this..

    I've used the Fold Page List to do what I think you're after, then outputting it how it's described here.

    Another option might be a plugin such as Simple Section Navigation.

  4. chuckienorton
    Member
    Posted 5 years ago #

    @karl19 Thanks, helped me a bunch!

Topic Closed

This topic has been closed to new replies.

About this Topic