Як відобразити список підсторінок поточної сторінки
Простий спосіб:
if(is_page('10')||is_page('270')||is_page('164')||is_page('111')) {
wp_list_pages( 'child_of='.$post->ID.'&title_li=' );
}
Альтернативний спосібз розширеною кастомізацією:
$post_parent = 125 /* тут задаємо номер сторінки, список підсторінок якої ми хочемо відобразити. Можна взяти із функцій, чи як завгодно. */
$args = array('post_parent' => $post_parent, 'post_type' => 'page', 'orderby' => 'menu_order', 'order' => 'ASC' );
$subpages = new WP_query($args);
if ($subpages->have_posts()) :
while ($subpages->have_posts()) : $subpages->the_post(); $i++;?>
<li>
<h3><a href="<?echo get_permalink();?>"><?echo get_the_title();?></a></h3>
<div class="panel loading">
<p><?echo get_the_excerpt();?></p>
</div>
</li><?
endwhile;
else :
$output = '<p>No subpages found.</p>';
endif;
wp_reset_postdata();