我有一个页面,应该显示我所有的投资组合帖子,但它只显示前10个,我不知道为什么
<div class="row">
<?php
$args = array(
\'post_type\' => \'portfolio\'
);
$the_query = new WP_Query( $args );
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="col-xs-3 portfolio-piece">
<h3 style="color:#1B7B98; text-align:center;">
<?php the_title(); ?>
</h3>
<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, \'thumbnail-size\', true );
?>
<p><a href="<?php the_permalink(); ?>"><img src="<?php echo $thumbnail_url[0]; ?>" alt="<?php the_title();?> graphic"></a></p>
</div>
<?php $portfolio_count = $the_query->current_post + 1; ?>
<?php if ( $portfolio_count % 4 == 0): ?>
</div><div class="row">
<?php endif; ?>
<?php endwhile; endif; ?>
</div>
最合适的回答,由SO网友:Rishabh 整理而成
尝试更改以下数组
$args = array(
\'post_type\' => \'portfolio\'
);
像这样使用阵列
$args = array(
\'post_type\' => \'portfolio\',
\'posts_per_page\' => -1 //It will display all of your posts
);