Wordpress category.php仅显示10篇文章

Wordpress category.php仅显示10篇文章,wordpress,Wordpress,我想在category.php上显示30篇文章,但在10篇文章之后,循环将终止,因为对于特定的类别,我有超过30篇文章。我用if(have_posts())在category.php上进行了尝试。Ohh我得到了答案。。它只是简单的设置->阅读->博客页面显示最多@Dibya 尝试这种方式来显示category.php上的帖子数量,而不影响博客页面 <?php $query = new WP_Query('category_name=Category&posts_per_pa

我想在category.php上显示30篇文章,但在10篇文章之后,循环将终止,因为对于特定的类别,我有超过30篇文章。我用if(have_posts())在category.php上进行了尝试。

Ohh我得到了答案。。它只是简单的设置->阅读->博客页面显示最多

@Dibya

尝试这种方式来显示category.php上的帖子数量,而不影响博客页面

<?php
    $query = new WP_Query('category_name=Category&posts_per_page=30');
    if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
    if (has_post_thumbnail()) {
        ?>
            <a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
        <?php
    }
    ?>
    <h2><a href="<?php the_permalink(' ') ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <?php
    the_excerpt(); // or the_content(); for full post content
    endwhile;endif;
?>


这也可以使用wp\u查询中的posts\u per\u page=-1参数来解决。通过使用它,您不需要担心后端设置。这将始终有效。

但这些也会改变博客页面上的帖子数量