• I’m currently using this script for my side sub-navigation on pages.php:

    <?php
    if ($post->post_parent)	{
    	$ancestors = get_post_ancestors($post->ID);
    	$root = count($ancestors) - 1;
    	$parent = $ancestors[$root];
    } else {
    	$parent = $post->ID;
    }
    $children = wp_list_pages("title_li=&child_of=". $parent ."&echo=0");
    if ($children) { ?>
    	<ul>
    		<?php print $children; ?>
    	</ul>
    <?php } ?>

    How can this script be tweaked so that no children pages are shown until you actually go down into one of the subcategories or sub-subcategories?

    So you would initially see:

    Subcategory 1
    Subcategory 2
    Subcategory 3

    If you clicked on Subcategory 2 (or any of its sub-subcategories), you would see:

    Subcategory 1
    Subcategory 2
    – Sub-subcategory 1
    – Sub-subcategory 2
    – Sub-subcategory 3
    Subcategory 3

    Any help would be greatly appreciated. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help w/ Sub-Navigation Script?’ is closed to new replies.