我正在寻找如何在子页面中显示父页面的子页面
我只能在父页面中显示所有子项,如下所示
<?php
$args = array(
\'post_type\' => \'page\', //write slug of post type
\'posts_per_page\' => -1,
\'post_parent\' => $post->ID,
\'order\' => \'ASC\',
\'orderby\' => \'menu_order\'
);
$childrens = new WP_Query( $args );
if ( $childrens->have_posts() ) : ?>
<?php while ( $childrens->have_posts() ) : $childrens->the_post(); ?>
<!-- child <?php the_ID(); ?> -->
<div class="grid-item grid-50" style="padding: 20px;">
<?php if ( $post->post_content=="" ) { ?>
<!-- IF NO CONTENT -->
<?php if ( has_post_thumbnail() ) { ?>
<!-- THUMBNAIL SEUL SANS LIEN -->
<?php echo get_the_post_thumbnail( $page->ID, \'full-size\' ); ?>
<?php edit_post_link(\'(add content?)\', \'<p>\', \'</p>\', null, \'editaddclass\'); ?>
<?php } else { ?>
<!-- BLOC VIDE -->
<div class="" style="padding: 20px; text-align: center; border: 1px dotted grey;">
CE BLOC EST VIDE<br>
<?php edit_post_link(\'(le supprimer / add content)\', \'<p>\', \'</p>\', null, \'editaddclass\'); ?>
</div>
<?php } ?>
<!-- OR WHIT CONTENT -->
<?php } else { ?>
<!-- SI LE CONTENU -->
<div class="">
<?php if ( has_post_thumbnail() ) { ?>
<!-- THUMBNAIL AVEC CONTENT & LINK -->
<a href="<?php the_permalink(); ?>">
<div><?php echo get_the_post_thumbnail( $page->ID, \'principal\' ); ?></div>
<div style="width: 100%; text-align: center; padding:10px"><?php the_title(); ?></div>
<?php edit_post_link(\'(modifier)\', \'<p>\', \'</p>\', null, \'editaddclass\'); ?>
</a>
<?php } else { ?>
<!-- IL Y A DU CONTENU MAIS PAS DE THUBNAIL -->
<div class="" style="padding: 70px 20px; text-align: center; background-color: #eee">
THUMBNAIL MANQUANTE<br>
</div>
<div style="width: 100%; text-align: center; padding:10px">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div>
<?php edit_post_link(\'(ajouter en une / modifier)\', \'<p>\', \'</p>\', null, \'editaddclass\'); ?>
<?php } ?>
</div>
<!-- /if le content -->
<?php }; ?>
</div>
<!-- /child <?php the_ID(); ?> -->
<?php endwhile; endif; wp_reset_query(); ?>
</div>
</div>
<!-- /CHILDREN -->
找不到如何在每个孩子的末尾显示它你听懂了吗?:)