Support » Fixing WordPress » How to add Pagination and resolve same posts on multiple pages on ANY theme

  • Resolved stupidzbu


    I came across this problem and found a bunch of threads on it, but no one really answered the question so I am going to state it very blatantly

    You have a query problem. Somewhere in your code, your loop is using query() to call the loop and this makes it impossible to paginate

    Some people suggested changing

    <?php endwhile; ?>
    <?php endwhile; wp_reset_query(); ?>

    Essentially resetting the loop and allowing pagination to occur. This worked for me on the WOO THEME PREMIUM NEWS THEME but every page ended up showing me the same posts.

    I then found This article that really explained it to me and after some fiddling, I finally got the code to work!

    This is a How-To specifically for that dreaded WOO Theme Premium News

    1) Install and activate any pagination plugin

    2) Edit Blog.php (or default.php if you have 2 columns) like this:

    The loop immediately begins with this code:
    $the_query = new WP_Query('cat=-'. $GLOBALS[ex_feat] . ',-' . $GLOBALS[ex_vid] . '&showposts=' . get_option('woo_other_entries') . '&orderby=post_date&order=desc');

    Right above that add the following code

    $temp = $the_query;
     $the_query= null;
     $the_query = new WP_Query();

    Then alter the loop to this:
    $the_query-><strong>query</strong>('cat=-'. $GLOBALS[ex_feat] . ',-' . $GLOBALS[ex_vid] . '&showposts=' . get_option('woo_other_entries') . '&orderby=post_date&order=desc'.'<strong>&paged='.$paged</strong>);

    Stuff happens … before the end of the document alter

    <?php endwhile; ?>
    <?php endwhile; wp_reset_query(); ?>

    3) and finally remove the archive coding and change it to this

    <div class="fix"></div>
    <p class="ar hl3">
    <strong>PLUGIN CODE GOES HERE</strong>
    <strong><?php $wp_query = null; $wp_query = $temp;?></strong>

    BAM! pagination on premium news theme

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to add Pagination and resolve same posts on multiple pages on ANY theme’ is closed to new replies.