Support » Fixing WordPress » issue with next_posts_link reloading same content as homepage

  • When I click Previous Page or Next Page, the URL reads http://mydomain.com/page/2/ but the contents look identical to http://mydomain.com.

    Judging from reading about other users with similar problems, my first theory is: there’s an issue with my permalinks interfering with my next_posts_link, previous_posts_link functions. Second theory: a mod rewrite issue.

    home.php looks like this:

    <div id="homecontentnav">
        <div id="prevLink"><p><?php previous_posts_link(); ?></p></div>
        <div id="nextLink"><p><?php next_posts_link(); ?></p></div>
    </div>

    And the URL the function spits out looks like: http://mydomain.com/page/2/

    “Front page displays” = Your latest posts

    “Blog pages show at most” = 10, but only 7 posts ever appear on the site – the 7 most recent posts, even if I click Next Page.

    permalink structure is custom = /%postname%/

    Any ideas would be appreciated, thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    link to your (real) site?

    does your front page template use any custom query?
    without the ‘paged’ parameter?

    “Blog pages show at most” = 10, but only 7 posts ever appear on the site – the 7 most recent posts

    this is weird, i would either expect that it shows 7 post, but no ‘next-posts-link’, or it shows the 10 posts and the link.

    home.php:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    …I’d prefer not to link to the real site in a public forum, but I can provide any more details you need if it would help.

    Thanks

    here’s the code again in pastebin:

    http://pastebin.com/kws3Tdns

    Michael

    (@alchymyth)

    Forum Moderator

    you could try and add:

    <?php wp_reset_query(); $paged = get_query_var('paged'); ?>

    before this line:

    <?php query_posts(array("post__not_in" =>get_option("sticky_posts"),"posts_per_page"=>6,"paged"=>$paged,"offset"=>1)); ?>

    @alchymyth – I tried that. No dice. Thanks for the suggestion though.

    esmi

    (@esmi)

    Forum Moderator

    I’d also suggest that you use wp-reset_query(); between the two Loops.

    esmi

    (@esmi)

    Forum Moderator

    You also need to place the first Loop inside an !is_paged() conditional – otherwise it will fire on every page instead of just the first page.

    Thanks, esmi – what is the syntax for an !is_paged() conditional?

    esmi

    (@esmi)

    Forum Moderator

    <?php if( !is_paged() ) :?>
    [ do stuff on the first page only here ]
    <?php endif;?>

    http://codex.wordpress.org/Conditional_Tags

    add wp-reset_query(); between the two loops: check!

    put first loop inside !is_paged() conditional statement: check!

    … still same problems as described in original post.

    thanks for the suggestions though.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘issue with next_posts_link reloading same content as homepage’ is closed to new replies.