Return to Snippet

Revision: 51930
at October 7, 2011 19:12 by innerstorm


Initial Code
function list_sub_pages () {
	global $wp_query;
	if( empty($wp_query->post->post_parent) ) {
		$parent = $wp_query->post->ID;
        echo "<h3>".get_the_title($parent)."</h3>";		
	} else {
		$parent = $wp_query->post->post_parent;
        echo "<h3><a href='".get_permalink($parent)."'>".get_the_title($parent)."</a></h3>";		
	}
    echo '<ul>';
    wp_list_pages("title_li=&child_of=$parent" );
    echo '</ul>';
}

Initial URL


Initial Description


Initial Title
List subpages of current page

Initial Tags
page, wordpress

Initial Language
PHP