WordPress.org

Support

Support » Themes and Templates » Wrapping a <div> around the 2nd-7th most recent posts

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

  • motionfour
    Member

    @motionfour

    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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…

    motionfour
    Member

    @motionfour

    I haven’t been able to find anything related to this in search… please help…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Wrapping a <div> around the 2nd-7th most recent posts’ is closed to new replies.