WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Page 2 sends me to home page, pages 3 and above work OK (1 post)

  1. andruxnet
    Member
    Posted 9 months ago #

    Hi, guys,

    I've been struggling with this for the last couple of days, and I can't get it to work.

    When I click on page 2 it takes me back to the home page, even the URL is the one for the home page. When I click on page 3 or 4 or whatever page number is greater than 2, it works perfectly.

    I have already tried using WP_Query or get_posts instead of query_posts, but nothing has worked - some other tries were even worse!

    I tried having wp_reset_query after, before, in the middle of the loop or the wp_pagenavi() call and still the same.

    Would anyone please have any suggestion to fix this? I'd appreciate any help very much.

    Thanks.

    Here's my code:

    <?php get_header(); ?>
    <?php
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        $args = array(
            'cat' => 10,
            'order' => 'DESC',
            'paged' => $paged,
        );
    
        query_posts( $args );
    ?>
    
        <?php while( have_posts() ): the_post(); ?>
            <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
    	<?php endwhile; ?>
        <?php wp_pagenavi(); ?>
    
    <?php get_footer(); ?>

    http://wordpress.org/plugins/wp-pagenavi/

Reply

You must log in to post.

About this Plugin

About this Topic

Tags