0
我有一個自定義類型發表我們的教員具有後XYZ和MTJ等,以及另一篇文章ABC和TKY蝕刻,XYZ是ABC和TKY的家長,我想只顯示ABC和TKY後顯示孩子後到WordPress頁面模板
像 -
XYZ
ABC(介紹)。
ABC_(description)。
MTJ
孩子後1(介紹)。
子帖子2(描述)。
<?php
/**
* Template Name: Blog
The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package Sydney
*/
get_header();
?>
<?php
$array = array('post_type'=>'our-trainers', 'posts_per_page' => 30, 'order' => 'ASC');
$array_query = new wp_query($array);
while ($array_query->have_posts()) : $array_query->the_post();
?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php //the_excerpt(); ?>
<?php
$array = array('post_type'=>'our-trainers', 'post_parent' => $post->ID, 'posts_per_page' => 30, 'order' => 'ASC');
$array_query = new wp_query($array);
while ($array_query->have_posts()) : $array_query->the_post();
?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<?php endwhile; // end of the loop. ?>
<?php endwhile; // end of the loop. ?>
只顯示最後的父母職位,並有兒童職位。
感謝。但父職位應該是動態的意味着它可以增加.. – devendra
@devendra在這種情況下,你需要檢查循環內。這將是另一種方式來做到這一點.... – Poiz