Show subpages using shortcode

To show subpages you can use Pagelist plugin.

Or you can add this code to functions.php:

function wp_list_subpages(){
    global $post;
    $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
        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 *