0
所以我有一个循环显示我的主页上的所有页面(不是职位)。我想修改循环,以便它只显示单个父页面的子项(页面ID号为116,仅供参考)。我应该如何修改下面的代码来做到这一点?在主页上显示一个父页面的孩子(Wordpress)
<?php query_posts('post_type=page&posts_per_page=-1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"
rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<div>
<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
<div ><?php the_title(); ?>
</div> <!-- headlines-title -->
</div></a>
<?php endwhile; endif; ?>
也想补充一点,显示孙子也是OK ...
把这个削减nt页面id,并且它根本不显示任何页面。 – user1631884
对不起,你必须安装这个插件才能工作http://wordpress.org/extend/plugins/pjw-query-child-of/ – Hareesh
找到了一个不需要安装插件的答案。不过,感谢您的帮助。 – user1631884