![](/img/trans.png)
[英]How to set maximum number of posts allowed for any specific custom post type in Wordpress
[英]How to set number of posts on wordpress custom post
我在functions.php 中创建了自定义帖子并且一切正常,但是我的循环只显示了9 个帖子。 我该怎么做才能显示所有这些? 我使用的循环:
<?php
$custompost_loop = new WP_Query($custompost);
if ($custompost_loop->have_posts()) : ?>
<?php while ($custompost_loop->have_posts()) : $custompost_loop->the_post();
?>
<div class="offer__single">
<h4 class="offer__title">
<?php echo get_the_title(); ?>
</h4>
</div>
<?php
endwhile;
?>
<?php endif;
wp_reset_postdata(); ?>
$custompost = array(
'posts_per_page' => -1,
'post_type' => 'your_post_type',
);
$custompost_loop = new WP_Query( $custompost );
在您的情况下,您可以将'posts_per_page' => -1,
到您的$custompost
数组中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.