Query_post()Wordpress

时间:2013-02-24 22:17:54

标签: wordpress

我正在尝试在内容区域中获取所有子页面的页面列表。但是,当我使用下面的代码时,它只显示40个子页面中的10个......

请告诉我如何解决?

<ul class="subpages-pro" style="margin-top:20px;">
<span style="display:none;"><?php the_ID(); ?></span>
<?php $parent = $post->ID; ?>
<?php
query_posts('order=ASC&post_type=page&post_parent='.$parent);
 while (have_posts()) : the_post();
?>

<?php $image_thumb = get_post_meta($post->ID, 'image-thumb', true); ?>
<li><?php the_post_thumbnail(); ?>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<?php the_excerpt(); ?>
</li>

<?php endwhile; ?>
</ul>

1 个答案:

答案 0 :(得分:2)

如果将参数numberposts = -1传递给query_posts函数,将显示所有页面。

因此,将您对query_posts的调用更改为:

query_posts ('order=ASC&post_type=page&numberposts=-1&post_parent='.$parent)