• Resolved dehog

    (@dehog)


    I have one post displaying on the main page, and then if one likes to view more posts they can click on the “Previous Posts” link at the bottom.

    I m using this code:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if( (is_home() || is_front_page() ) && !is_paged() ) $posts_per_page = 1;
    else $posts_per_page = get_option('posts_per_page ');
    query_posts('posts_per_page=' . $posts_per_page. '&paged=' . $paged);
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    by: esmi

    But here’s the problem, when I click “Previous Posts” it skips the 5 posts and starts showing from the 6th post on the following page.

    Could some one help with that, I would want to see the following page contain posts from the very immediate previous post.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if( (is_home() || is_front_page() ) && !is_paged() ) {
    	$args= array(
    		'posts_per_page' => 1,
    		'paged' => $paged
    	);
    }
    else {
    	$args= array(
    		'posts_per_page' => get_option('posts_per_page '),
    		'offset' => 1,
    		'paged' => $paged
    	);
    }
    query_posts($args);
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    Thread Starter dehog

    (@dehog)

    This is awesome. Thank you so much. It Works! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘More posts link skips a few posts’ is closed to new replies.