WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. animeshtripathi
    Member
    Posted 2 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?

    Animesh

  2. animeshtripathi
    Member
    Posted 2 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. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    general idea on how to avoid duplicate posts:
    http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action

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

  4. animeshtripathi
    Member
    Posted 2 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:

    http://thinkrasta.com/home

  5. animeshtripathi
    Member
    Posted 2 years ago #

    *bump* ! Can someone help me out please?

  6. animeshtripathi
    Member
    Posted 2 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:

    http://pastebin.com/cYK7GEb7

Topic Closed

This topic has been closed to new replies.

About this Topic