• Hello. I have a situation that seems a bit more complicated than your average List Subpages technique.

    That technique creates this:

    • A1
    • A2
    • A3

    or

    • B1
    • B2
    • B3

    or

    • C1
    • C2
    • C3

    However, my client’s sidebar navigation is more like this:

    A section:

    • A
    • A1
    • A2
    • A3

    B section:

    • B
    • B1
    • B2
    • B3

    C section:

    • C
    • C1
    • C2
    • C3

    The “A” section display only the links pertaining to the “A” section homepage or its children. The “A” section does not display any “B” or “C” links.

    Likewise for any “B” section or any “C” section.

    Any ideas? Thanks!
    STAN

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter stanleydankoski

    (@stanleydankoski)

    This is the code to help you figure out where I’m coming from:

    if (is_page()) {
            // we're looking at a static page.  Which one?
            if (is_page('2')) {		// About Us page.
                 echo "<ul style='margin-bottom: 0px;'>";
    			    wp_list_pages('title_li=&include=2&sort_column=menu_order&depth=2&child_of=0');
    			 echo "</ul>";
            } elseif (is_page('60')) {		// Menu/Wine List page.
                 echo "<ul style='margin-bottom: 0px;'>";
    			    wp_list_pages('title_li=&include=60&sort_column=menu_order&depth=1&child_of=0');
    			 echo "</ul>";
            } elseif (is_page('44')) {		// Private Dining page.
                 echo "<ul style='margin-bottom: 0px;'>";
    			    wp_list_pages('title_li=&include=44&sort_column=menu_order&depth=1&child_of=0');
    			 echo "</ul>";
            } elseif (is_page('26')) {		// Contact Us page.
                 echo "<ul style='margin-bottom: 0px;'>";
    			    wp_list_pages('title_li=&include=26&sort_column=menu_order&depth=1&child_of=0');
    			 echo "</ul>";
            } else {
                  // catch-all for other pages
                  //echo "<p>Vote for Pedro!</p>";
            }
    
    		// for ALL pages
    
    			if($post->post_parent)
    			$children = wp_list_pages("title_li=&child_of=" . $post->post_parent."&echo=0");
    			else
    			$children = wp_list_pages("title_li=&child_of=" . $post->ID."&echo=0");
    			if ($children) {
    				echo "<ul style='margin-top: 0px;'>";
    				echo $children;
    				echo "</ul>";
    			}
    }
    Thread Starter stanleydankoski

    (@stanleydankoski)

    Ah. Finally found the answer, testing for subpages.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Listing subpages only for certain sections’ is closed to new replies.