WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pagination disfunction - Pages show the same posts (3 posts)

  1. carloravelli
    Member
    Posted 1 year ago #

    I'm running a wordpress site for a client and he recently came up with a problem with the pagination: When you go to the second page of his blog, it shows exactly the same posts as the first page, when it should display older posts.

    I tried using 2 different pagination types (wp_pagenavi and twentyeleven) but they both get the same thing.

    What could I be doing wrong?

    This is what my archive.php looks like:

    <?php get_header(); ?>
    <div class="content">
    		<h1><?php single_cat_title(); ?></h1>
    		<?php $currentCat = get_query_var('cat'); ?>
    <?php
    if(cat_is_ancestor_of(3, $currentCat)) {
    } else {
    	// The Query
    	query_posts( 'cat=-34,-35,-6,' );
    }
    
    // The Loop
    while ( have_posts() ) : the_post(); ?>
    
    --- the post html ---
    
    <?php endwhile;
    
    // Reset Query
    wp_reset_query();
    ?>
    </div>
    <?php wp_pagenavi(); ?>
    <?php get_footer(); ?>
  2. cykeltomte
    Member
    Posted 1 year ago #

    Insted of

    query_posts( 'cat=-34,-35,-6,' );

    try

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts( 'cat=-34,-35,-6&paged=' . $paged );
  3. carloravelli
    Member
    Posted 1 year ago #

    Awesome, works right away, thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic