• Resolved bethanyb

    (@bethanyb)


    I’ve created what amounts to a category page here

    http://grayingofaids.org/blog

    I’ve used the following at the start of the loop to call posts from a specific category, and display 3 posts per page


    <?php
    $temp = $wp_query;
    $wp_query = NULL;
    $wp_query = new WP_Query();
    query_posts( array ( 'category_name' => 'Blog', 'posts_per_page' => 3 ) );

    while ($wp_query->have_posts()) : $wp_query->the_post();

    ?>

    The pagination links appear at the bottom of the page (Older Posts, Newer Posts,) but when clicked, they display only the same first 3 posts as the front page. Any idea why this might be happening?

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    //The Query
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('posts_per_page=3&cat=###&paged=' . $paged);
    //The Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    ?>

    Replace ### with the category ID number.

    Thread Starter bethanyb

    (@bethanyb)

    Brilliant, thank you so much!

    My pleasure. I asked exactly the same question once.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pagination issue with category page’ is closed to new replies.