Show subpages using shortcode

To show subpages you can use page-list plugin.

Or you can add this code to functions.php:

<?php
function wp_list_subpages(){
    global $post;
    $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
    if($children)
        return "<ul>".$subpages."</ul>";
}
add_shortcode('subpages', 'wp_list_subpages');
?>

And then you can use this shortcode [subpages] inside of your page content to show list of subpages.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">