Шоткод для вывод дочерних страниц
<?php
add_shortcode( 'subpages', 'my_subpages' );
function my_subpages() {
$id = get_the_ID();
if ( false === $id ) {
return '';
}
$pages = get_pages( array(
'parent' => $id,
) );
$html = '';
if ( $pages ) {
foreach ( $pages as $page ) {
$title = get_the_title( $page->ID );
$href = get_permalink( $page->ID );
$html .= sprintf( '<li><a href="%s">%s</a></li>', $href, $title );
}
}
return $html ? sprintf( '<ul>%s</ul>', $html ) : '';
}