WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pagination with multiple columns / custom loops (2 posts)

  1. bschiav
    Member
    Posted 2 years ago #

    For a blog I'm working on, I've created two columns. Each column loops posts from a certain category. It's not clear to me how to get the pagination to work correctly.

    ...I'm not quite sure where to put the pagination code:

    <?php stumblr_pagination(); ?>
    <?php echo paginate_links( $args ) ?>

    I have a container DIV, and then one DIV for each column. If I place the code in the container but outside of the columns...then my pagination links do not display. If I place the code just after the loop completes in one of the columns...then the links display. However they still do not work, clicking the links only returns the same sets of posts.

    The site is at http://www.shasnap.com

    I found this link Paging and Custom WordPress Loops, but I probably was not implementing it correctly. I'm really only putzing through this relying on a heck of a lot of google searching.

    So where should the pagination code go? And second, can anyone assist me in getting it to work? Thanks for your time in advance.

  2. bschiav
    Member
    Posted 2 years ago #

    Solved; Codex link

    and WP_Navi support link that helped gave me the fix:
    http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html

    Most of the time, your theme is just using query_posts() wrong.

    So here is the correct way to make paging work using query_posts():

    Say you have something like this:

    query_posts('cat=8');
    or like this:

    query_posts( array( 'cat' => 8 ) );
    If the file in question is a custom page template, replace it with this:

    query_posts( array( 'cat' => 8, 'paged' => get_query_var('page') ) );
    Otherwise, replace it with this:

    query_posts( array( 'cat' => 8, 'paged' => get_query_var('paged') ) );

Topic Closed

This topic has been closed to new replies.

About this Topic