WordPress.org

Ready to get started?Download WordPress

Forums

paging borked when featured post loop and regular loop is on a page (3 posts)

  1. noise
    Member
    Posted 3 years ago #

    Hello
    Googled my brain out - tried everything I could think of - still not joy.

    The site has an index.php (using the "Show your latest posts" option) with a featured story and then the rest underneath.

    The problem is when you click on the "older posts" it just returns the same first page.

    The featured post loop is
    `<?php query_posts('showposts=1'); $ids = array();
    while (have_posts()) : the_post();
    $ids[] = get_the_ID(); ?>`

    The loop under that displays the posts minus the id from the $ids

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
    'post__not_in' => $ids,
    'paged'=>$paged,
    );
    query_posts($args);
    while (have_posts()) : the_post(); ?>

    I tried using WP-Paginate and WP-Pagenavi, no better

    Anyone out there know what that what would be causing this?

    Thanks

  2. alchymyth
    Forum Moderator
    Posted 3 years ago #

    try to add
    wp_reset_query();
    before this line:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

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

  3. noise
    Member
    Posted 3 years ago #

    jeesh ... you know I tried adding the reset_querty in many of the previous attempts at fixing it, just figured that wasn't the issue in this case.

    That did fix it thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic