WordPress.org

Ready to get started?Download WordPress

Forums

Next/Previous Links from Home Page Show Same Posts (posts displayed in two sets) (2 posts)

  1. relequestual
    Member
    Posted 5 years ago #

    Hi all.
    Ive seen this problem before (http://wordpress.org/support/topic/161229?replies=8) However I cannot implement the solution.

    My home page shows posts in a slightly different way. Let me try and explain.
    The code below shows the first post.

    <!-- First Post -->
      	<?php $top_query = new WP_Query('showposts=1'); ?>
      	<?php while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID; ?>

    Then after, a different div style is used to display the next lot of posts for the page.

    <!-- Next few posts -->
      	        <?php $next_query = new WP_Query('showposts=6'); ?>
    		<?php while($next_query->have_posts()) : $next_query->the_post(); if(!($first_post == $post->ID)) : ?>

    This isn't my theme, so I really lack the ability to understand how to edit it to implement the fix.

    Can anyone help me out here?

    thanks in advance

    rel

  2. svajus
    Member
    Posted 5 years ago #

    I have the same problem. My first post code looks like this:

    <?php $top_query = new WP_Query('showposts=1'); ?>
    <?php while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID; ?>

    And secondary posts code i have changed to:

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=-3&paged=$paged");
    }
    ?>

    Now with secondary posts everything is ok. When I press previous entries button secondary posts change to older ones but I still see my first post :(. What is the solution? Please help me. I was trying to search google for ages.. You can see how it works at http://topten.lt

    Sorry for my English.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.