【发布时间】:2013-01-08 21:10:56
【问题描述】:
我的 Wordpress 主题中有一个部分,我在其中获取子页面以显示其信息。这就是我现在拥有的:
<?php
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
$staff = get_page_children(8, $all_wp_pages);
foreach($staff as $s){
$page = $s->ID;
$page_data = get_page($page);
$content = $page_data->post_content;
$content = apply_filters('the_content',$content);
$content = str_replace(']]>', ']]>', $content);
echo '<div class="row-fluid"><span class="span4">';
echo get_the_post_thumbnail( $page );
echo '</span><span class="span8">'.$content.'</span></div>';
}
?>
我有五个应该显示的子页面,但只有三个返回。我在 $staff 上使用 print_r 来查看其他页面是否甚至在数组中,但它们不是。我不确定可能是什么问题。
【问题讨论】:
-
Wordpress 允许多个孩子吗?
-
这可能是你的问题吗?它只返回当前页面是选择的第一个父级的页面还是什么?