0
に子ポストを表示するなど、ポストXYZとMTJを持っているし、別のポストABCとTKYエッチング、XYZがされABCとTKYの親は私だけABCとTKYポストを表示したい</strong>私たちのトレーナー<strong>私はカスタム・タイプのポストを持っているWordpressのページテンプレート
様 -
XYZ
ABC(説明)。
ABC_(説明)。
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