[resolved] Excluding the featured post from the other posts (offset?) (6 posts)

  1. animeshtripathi
    Posted 3 years ago #

    Hi, I'm editing my WordPress blog a bit. I have a featured post with a static image on the top, followed by a grid of other posts. Now, when I get the posts using PHP in index.php, it automatically fetches all posts, including the featured post. The featured post is the most recent post. I don't want the featured post to appear here. The URL is http://thinkrasta.com/home Here's the code I'm using to get the 'other' posts:

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

    Thanks in advance. Could I use an 'offset' attribute for this? If so, how?


  2. animeshtripathi
    Posted 3 years ago #

    Here's the code:

    <?php while(have_posts()): the_post(); ?>
    				<?php if($count == 3): $count = 1; endif; if($count == 2): $class = 'last'; else: $class = ''; endif; ?>
    				<div class="item <?php echo $class; ?>">
  3. Michael
    Part-Time Forum Moderator
    Posted 3 years ago #

    general idea on how to avoid duplicate posts:

    can you paste the full code of your template into a pastebin.com and post the link to it here?

  4. animeshtripathi
    Posted 3 years ago #

    Hi alchymth,

    Thanks for your response. Here's the full code: http://pastebin.com/J52mueyU

    You could see how the homepage looks at:


  5. animeshtripathi
    Posted 3 years ago #

    *bump* ! Can someone help me out please?

  6. animeshtripathi
    Posted 3 years ago #

    So, I fixed it! I created a new query array for the other posts (the second loop being displayed)with offset=1, orderby= date, and it works!

    here's the new code, if anyone needs to see it:


Topic Closed

This topic has been closed to new replies.

About this Topic