Dibya Krushna Das
Dibya Krushna Das

Reputation: 131

category.php displaying only 10 posts

I want display 30 posts on category.php , but after 10 post loop is terminating where as i have more then 30 posts for particular category . I have tried on category.php with if(have_posts() )

Upvotes: 1

Views: 1365

Answers (3)

user8046090
user8046090

Reputation:

This can also be resolved using posts_per_page = -1 parameter in wp_query. By using this , you don't need to bother about the backend settings. This will always works.

Upvotes: 1

Vishal Varshney
Vishal Varshney

Reputation: 905

@Dibya

try this way to show the number of posts on category.php without affecting blog page

<?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;
?>

Upvotes: 0

Dibya Krushna Das
Dibya Krushna Das

Reputation: 131

Ohh i got answer .. It is simply SETTINGS -> READING -> Blog pages show at most

Upvotes: 2

Related Questions