“Next posts” of a category do not call category.php

I try to add a pagination system on my category.php page.

It works for the first page : for example url/category/cat1/. Good number of posts is displayed and I get a “read more” link only when it’s needed…

But for the second page : for example url/category/cat1/page/2/. It doesn’t load the code from category.php but from index.php !

What am I missing ?

Code from category.php :



    $categories = get_the_category();

    if ( ! empty( $categories ) ) 
        $category = $categories[0]->name;
    $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;

    query_posts( 'category_name='.$category.'&posts_per_page=1&paged='.$paged );

    while (have_posts()) :


        echo'<a href="'.get_permalink().'"> Read more...</a>';



     <div class="navigation">
     <div class="alignleft"><?php previous_posts_link('&laquo; Previous Entries') ?></div>
     <div class="alignright"><?php next_posts_link('Next Entries &raquo;','') ?></div>




Read more here: “Next posts” of a category do not call category.php

Leave a Reply

Your email address will not be published. Required fields are marked *