我正在尝试使用query\\u posts列出页面ID的所有子代。使用post\\u parent只列出第一级子代。
这张Trac票据似乎解决了这个问题:http://core.trac.wordpress.org/ticket/5742, 但我不明白——post\\u parent只列出第一级的子级。
<?php
query_posts( array(
\'post_parent\' => 58, // Only shows posts that are direct children of the Machinery page. I want all descendants.
//\'child_of\' => 58, // When used, shows posts filterd by taxonomy and term, but not filtered by child of ID 58. Acutally omits direct child of 58 but shows grandchild.
\'post_status\' => \'any\',
\'post_type\' => \'any\',
\'taxonomy\' => \'industries\',
\'term\' => \'dairy\'
));
?>
<?php if ( have_posts() ) : ?>
<h4>Dairy Machinery</h4>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; wp_reset_query(); ?>
如何让query\\u帖子列出页面ID的所有子体?