我正在开发一个自定义页面模板,该模板在带有分页的父页面中显示子页面。
它正在工作,但页眉和页脚未正确显示。但是当我删除了自定义页面的 PHP 文件时。页眉和页脚恢复正常。
我的 PHP 代码有什么问题?
这是片段:
<?php
$ids = array();
$pages = get_pages("child_of=".$post->ID);
if ($pages){
foreach ($pages as $page){
$ids[] = $page->ID;
}
}
$paged = (get_query_var("paged")) ? get_query_var("paged") : 1;
$args = array(
"paged" => $paged,
"post__in" => $ids,
"posts_per_page" => 5,
"post_type" => "page"
);
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post();
?>
<div>
<h3><?php the_title(); ?></h3>
<div><?php the_date(); ?></div>
<p><?php the_content(); ?></p>
</div>
<?php endwhile; ?>
<?php endif;
paging_nav();
wp_reset_query();
?>