WordPress.org

Ready to get started?Download WordPress

Forums

Pagination not chronological on page 2,3,etc. (1 post)

  1. cliffmusic29
    Member
    Posted 1 year ago #

    I have modified my category pages so that they bring in posts in a category in order depending what area of the page.

    In my code you can tell im calling an "offset" of 4 in the loop ... meaning this section picks up the 4th post in that category and goes from there.

    When i click on page 2 of the category, the template is still bringing in the 4th post and so on because i hard-coded it that way.

    How can i put in the PHP that if this is page 2 i want it to start with post 8, and if this is page 3 I want it to start with post 12, etc....


    <?php
    global $more;
    $more = 0;

    if ( is_front_page () ) $paged = get_query_var( 'page' );
    $wp_query = new WP_Query('post_type=post&posts_per_page='.$pagination.'&cat='.$blog_ids.'&paged=' . $paged.'&offset=4');

    if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();

    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic