• Hi,

    I am trying to hack at an existing theme and have become stuck.

    My blog has a horizontal top bar which is my main navigation. I have set the “depth” to 1 on this so that any sub-pages (or child pages as it were) do not display. In other words, only the parent pages of my blog appear in this top navigation.

    When a user clicks on a specific parent page. I want all the child pages for that parent to appear in a vertical sidebar.

    Can anyone let me know how I might do about doing this?

    Thanks – the site is https://www.macmillan-academy.org.uk/staff_blogs/mrking

Viewing 16 replies (of 16 total)
  • Thread Starter adeking

    (@adeking)

    Hi Sadish,

    I have taken this off as resolved just so I can ask another quick question. The sub-links for parent pages are working, however when you then click into a sub-page becasue the code is only looking to see if the “active” page has a parent – the navigation disappears. The best way to show this is for you to look at my blog.

    https://www.macmillan-academy.org.uk/staff_blogs/mrking/?page_id=13

    On this page I have created two sub-pages testing 123 and test. When the user clicks on testing123 I need the navigation for test to still be visible. The code I have used in my sidebar is below.

    <?php
    $sub_pages = wp_list_pages( 'sort_column=menu_order&depth=2&title_li=&echo=0&child_of=' . $id );
    if ($sub_pages <> "" ) {?>
     <div class="box-1">
                <div class="box-h">  
    
    	<h4><?php the_title(); ?></h4>
    
    <ul><?php echo $sub_pages; ?></ul>
    </div>
    	</div>
    	<?php }?>

    Hope you can continue to help….

Viewing 16 replies (of 16 total)
  • The topic ‘wp_list_pages() question’ is closed to new replies.