WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Permalink conflict with PageNavi (1 post)

  1. juri003
    Member
    Posted 4 months ago #

    Hi there,

    My pagenavi setup is bugging in a WP_query on single posts. I found many possible solutions but none worked for me. Also I realise it is probably more related to wp itself but hopefully someone can see what I am doing wrong here.

    The problem

    • Pagenavi works fine on my category page where the function is being called after the loop with wp_pagenavi()
    • On my single page I have the same post list build with wp_query. The pagination is displayed and the pagelinks are correct (../page/2/) but when loading the url the parameters are removed and the same page is loaded

    My Setup

    • My custom permalink structure is: /%category%/%postname%/
    • My optional permalink base has no input
    • My current query is this:
    <?php
                $args = array(
                   'cat' => $category_id,
    	       'posts_per_page' => 4,
    	       'paged' => get_query_var('paged')
                 );
    	    $news = new WP_Query($args);
    	    $post_counter = 0;
                while ($news->have_posts() ) : $news->the_post();
    	    $post_counter++;
    ?>

    My loop

    <?php
                endwhile;
    	    wp_pagenavi( array( 'query' => $news  ) );
    	    wp_reset_postdata();
    ?>

    Explored solutions:

    Thanks in advance for having a look!

    juri

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

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

Reply

You must log in to post.

About this Plugin

About this Topic