WordPress.org

Ready to get started?Download WordPress

Forums

Wrapping a <div> around the 2nd-7th most recent posts (3 posts)

  1. motionfour
    Member
    Posted 7 years ago #

    Hi,
    I need to "wrap" a div around the 2nd-7th most recent posts, so that it looks something like this:

    <div id="entry-1">
    <a post 1 stuff></a>
    </div>

    <div id="entry">
    <a post 2 stuff></a>
    <a post 3 stuff></a>
    <a ...... stuff></a>
    <a post 7 stuff></a>
    </div>

    At the moment it looks like:

    <div id="entry-1">
    <a post 1 stuff></a>
    </div>
    <div id="entry">
    <a post 2 stuff></a>
    </div>
    <div id="entry">
    <a post 3 stuff></a>
    </div><br />

    etc etc

    I am using:

    <?php $postclass = ($post == $posts[0]) ? 'entry-1' : 'entry'; ?>

    to make the most recent post be distinguishable from the rest and am using:

    <div id="<?php echo $postclass; ?>">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <img class="<?php echo $postclass; ?>"
    src="<?php the_excerpt_rss(); ?>"></a>
    </div>

    to achieve this.

    I was thinking that I could have the most recent post kept seperate from the rest but I can't work out how to seperate them and I can't work out how to wrap the <div> around the other 6 posts.

    I've never used php (but I'm fairly good at html and css) but it might be obvious; any help is greatly appreciated.

    http://www.motionfour.com

  2. yosemite
    Member
    Posted 7 years ago #

    Try a search? I saw this addressed within the last 48(?) hours. Their approach was to isolate the first post, but I think the results would be the same...

  3. motionfour
    Member
    Posted 7 years ago #

    I haven't been able to find anything related to this in search... please help...

Topic Closed

This topic has been closed to new replies.

About this Topic