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:
http://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.
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!