0
我有以下WordPress的育兒問題
GrandParent
-Parent01
--Child
-Parent02
--Child
--Child
-Parent03
--Child
我希望能夠找到一個解決方案,當IM的祖父母頁面上,它只會返回父母,而不是孩子IE。
GrandParent
-Parent01
-Parent02
-Parent03
這是我目前的代碼,它產生的所有的父母和祖父母頁的兒童,並把它們放入一個表。
<?php $postid = get_the_ID(); ?>
<?php /* $pages = get_pages(array('child_of' =>$postid)); */
$pages = get_children(array(
'numberposts' =>30,
'post_parent' => $heading_page->post_id
));
$tCount= 0;
?>
<table align="center" width="100%"><tr>
<?php foreach ($pages as $page): ?>
<?php if($tCount % 2 == 0)
{
echo '</tr><tr>';
}?>
<td>
<div id="polaroid">
<figure>
<a href="<?php echo get_permalink($page->ID); ?>">
<?php echo get_the_post_thumbnail($page->ID, array(300,250)); ?></a>
<figcaption>
<a href="<?php echo get_permalink($page->ID); ?>"><?php echo $page- >post_title ?>
</a></figcaption>
</figure>
</div>
</td>
<?php $tCount++; endforeach; ?>
</tr></table>