2014-07-19 5 views
0

워드 프레스 육아 문제

GrandParent 
-Parent01 
--Child 
-Parent02 
--Child 
--Child 
-Parent03 
--Child 

나는 임은 조부모 페이지에, 그것은 단지 부모가 아니라 자녀 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> 

답변

1

이 일치하지 않을 때 당신은 단지 post_parent 루프의 속성과 continue을 확인할 수 있습니다 $heading_page->post_id$postid = the_post_ID();가 같은 값 있다고 가정 :

<?php foreach ($pages as $page): ?> 
<?php if ($postid != $page->post_parent) continue; ?>