我创建了一个查询来调用当前父页面的所有子页面。这很好用,但是每个子页面都有一个自定义模板。我不知道如何添加自定义查询参数来说明模板。目前我为每个子页面查询 the_content,但这并没有考虑到模板。
谁能帮我修改查询?
<?php $children = get_pages(
array(
'sort_column' => 'menu_order',
'sort_order' => 'ASC',
'hierarchical' => 0,
'parent' => $post->ID,
'post_type' => 'projects',
'meta_query' => array(
array(
'key' => '_wp_page_template',
'value' => 'template-city.php', // template name as stored in the dB
)
)
));
foreach( $children as $post ) {
setup_postdata( $post ); ?>
<div class="section-container">
<?php the_content(); ?>
</div>
<?php } ?>