• Hi all,

    I have used the Regulus tempalte before and love the way that the child pages to a parent page only show up once you go to the parent page.
    I’m trying to build a photo site for a friend at the moment and need a theme that does this also, so he can have a menu item ‘Photos’ then when you’re on that page a menu comes up in the sidebar which lists all the child pages underneath it.

    Many thanks!
    jeni

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter jenster81

    (@jenster81)

    Hiya,

    This is good for me for a different purpose, but i really want a theme which lists the child pages once you are on the parent page.

    either that or a plugin which allows dropdown menu function but then im not too technical so the suckerfish method or similar may make me out of my depth!
    thanks

    This code will list the child pages when on a parent page and include the parent page title in h2 tags above the list of child pages. It also display other child pages of a parent page when on a child page.

    <h2>
    
    <?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> Pages
    
    </h2>
    
    <?php
    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) { ?>
    
    <ul>
    <?php echo $children; ?>
    
    </ul>
    
    <?php } ?>

    See it in action here:

    https://www.themes.educationthemes.co.uk/icy-blue/

    The code should go wherever you want to display the list of child pages. In the above example that was in my sidebar.

    Can you put it just any where in the sidebar code?

    Thanks never mind, I did a search a found a plugin called Flexi Pages Widget, it did exactly what I wanted.

    Thread Starter jenster81

    (@jenster81)

    hiya – educationthemes

    do you put this in your sidebar theme editor file or in a text widget box as part of your sidebar?

    sorry for being thick

    I have put this in my sidebar.php file. Put it in the location that you want the list to appear.

    Hello educationthemes –

    I just tried the code you provided in my sidebar, and am unable to get it to work (WP version 2.6.1).

    Is there something that needs to be updated in order to get this working?

    Thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Looking for a template that lists child pages once you go to the parent page’ is closed to new replies.