• I am trying to get a home.page to show the first post with the update icon. SO I created a get_post at the front of home.php, but now that post is repeated directly below. What do I need to do to skip that post?

    Link

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • you should build a new query ..
    And then use the OFFSET
    Like so :

    First

    <?php $first_query = new WP_Query(‘showposts=1’); ?>
    <?php while($first_query->have_posts()) : $first_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <div class=”first”>
    <h3>the title</h3>
    <?php the_content(“»» ” . the_title(”, ”, false)); ?>
    </div>
    <?php endwhile; ?>

    second

    <ul class=”second”>
    <?php $first_query = new WP_Query(‘showposts=9&offset=1‘); ?> //** 9 is only an example, you can have any number or unlimit /**
    <?php while($first_query->have_posts()) : $first_query->the_post();
    $do_not_duplicate = $post->ID; ?>

    <li id=”post-<?php the_ID(); ?>” class=”<?=($i%2)?”odd”:”even”;$i++;?>”>” title=”<?php the_title(); ?>” rel=”bookmark”><?php the_title(); ?>  »»
    <?php endwhile; ?>

    (This example, with the right CSS, wil lalso HIGHLIGHT the first post.

    You can read more about MULTIPLE LOOPS in the codex

    (sorry , the code got messed up above ..

    Thread Starter joebrooksie

    (@joebrooksie)

    Problem is when I do that the pagination doesn’t work. Each new /page/2/ link goes toward the same page.

    well, like i wrote, you need to CSS that …

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘home.php – need help with get_post, duplicate posts’ is closed to new replies.