WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WP-PageNavi highlighted box always stuck at page 1 (10 posts)

  1. aznaddict
    Member
    Posted 3 years ago #

    No matter what page I go to, the highlighted box is always stuck at page 1

    e.g.
    I click box 4 and it takes me to page 4 but box 1 remains highlighted.

    Site:
    Conspiracy Theories

    I saw someone else with PageNavi problems today. Is this some kind of conspiracy? ^o^

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    i assume that one of the sidebar widgets or plugins (recent published, recent debates) is messing with the query_string; and the wp-pagenavi at the bottom does get the wrong or no indication of the page it is on.

    try to add wp_reset_query(); before the call of wp-pagenavi.

    http://codex.wordpress.org/Function_Reference/wp_reset_query

  3. aznaddict
    Member
    Posted 3 years ago #

    Wow, thanks! That did the trick

  4. Steven Jones
    Member
    Posted 3 years ago #

    Hi, I was having a similar problem now I have added the wp_reset_query the search is only bringing back one page worth of results.

    http://pastebin.com/ujKgg7mT

    What am I doing wrong?

    Cheers,
    Steve

  5. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    @Steven Jones

    what template is this?

    i think, in your case, the 'wp_reset_query();' is not the solution, as you want the pagination to work with your custom query.

    can you describe your initial problem in more detail?
    was the page number stuck to one fixed position while the pagination was working?

    can you post a link to your site to illustrate what is happening?

  6. Steven Jones
    Member
    Posted 3 years ago #

    http://newtonaycliffeindustrial.co.uk/premises/

    There's the page in question.

    I have removed the wp_reset_query and as you can see it's stuck on the first one.

    http://pastebin.com/8JiNaJX0

    Cheers.

  7. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    the problem with your pagination is, that it always stays at the first page, despite showing a different number in the address abr.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                        query_posts('propertytype=industrial,offices&posts_per_page=4&. $paged'); ?>

    the 'paged' parameter is not properly included;
    also from wp3.1, it is 'page' instead of 'paged'
    http://codex.wordpress.org/Function_Reference/WP_Query#Pagination_Parameters

    try:

    $paged = (get_query_var('page')) ? get_query_var('page') : 1;
                        query_posts('propertytype=industrial,offices&posts_per_page=4&paged='. $paged); ?>
  8. Steven Jones
    Member
    Posted 3 years ago #

    alchymyth - that didn't work.

    I have just been looking around and noticed that there's a problem with using a static page for the front page and pagination.

    Interesting topic here:

    http://wordpress.org/support/topic/wp-30-bug-with-pagination-when-using-static-page-as-homepage-1?replies=21

    Anything in there worth trying?

    Cheers.

  9. Steven Jones
    Member
    Posted 3 years ago #

    Hi, I looked through that post and tried some stuff - looks like Nathan Rice came up with the solution. Here is my fix.

    <?php
    if ( get_query_var('paged') ) {
        $paged = get_query_var('paged');
    				}
    elseif ( get_query_var('page') ) {
        $paged = get_query_var('page');
    
    } else {
        $paged = 1;
    }
    query_posts( array('propertytype' => 'industrial,office',  'posts_per_page' => 4, 'paged' => $paged)); ?>

    Really appreciate your help.

  10. Stefan83
    Member
    Posted 2 years ago #

    I'm having the same problem. The permalink changes but the content and the navi link stays on page 1. Here's my template file:
    http://pastebin.com/A0WBPSfT

    Any ideas? Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags