Forums

[resolved] Make the most recent post take up a whole row? (7 posts)

  1. Lalato
    Member
    Posted 1 year ago #

    I'm playing around with Threattocreativity v2.3 and I'm wondering if I can make it so that the first/most recent post takes up a whole row.

    What would be even cooler than that is if I could make it so that the first post takes up a whole row, the next two older posts make up a 2 column row and the rest of the posts follow the normal 3 column style. Like this...

    [1........]
    [2..] [3..]
    [4] [5] [6]
    [7] [8] [9]

    If anyone has ideas on how to make that work, please post them here.
    Thanks!
    --sam

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    the idea:
    use conditional tags to restrict this to the front page;
    use counter to add extra css classes to the .post class, for the first three posts.

    index.php:

    <div onclick="location.href='<?php the_permalink() ?>';" style="cursor:pointer;background:#<?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?>;" class="post bg thickbox <?php if( !is_paged() && !is_archive() ) { $count++; if( $count == 1 ) { $extra_class = 'fullwit'; } elseif( $count == 2 || $count == 3 ) { $extra_class = 'halfwit'; } else { $extra_class = '';  } }; echo $extra_class; ?>" id="thickbox post-<?php the_ID(); ?>">

    style.css

    .post.fullwit { width: 660px; }
    .post.halfwit { width: 315px; }
  3. Lalato
    Member
    Posted 1 year ago #

    Thanks, alchmyth. I'll give that a try.

  4. Lalato
    Member
    Posted 1 year ago #

    That worked perfectly, alchmyth. Thanks!

  5. Lalato
    Member
    Posted 1 year ago #

    Just wondering, how would that work if using post_class instead of class? Thanks!

  6. alchymyth
    The Sweeper
    Posted 1 year ago #

    using post_class() - replace this section:

    class="post bg thickbox <?php if( !is_paged() && !is_archive() ) { $count++; if( $count == 1 ) { $extra_class = 'fullwit'; } elseif( $count == 2 || $count == 3 ) { $extra_class = 'halfwit'; } else { $extra_class = ''; } }; echo $extra_class; ?>"

    for instance with something like:

    <?php $count++; $extra = (!is_paged()&&!is_archive())?($count<=1?'fullwit':($count<=3?'halfwit':'')):''; $post_class(array('post','bg','thickbox',$extra)); ?>

    (untested)

    http://codex.wordpress.org/Function_Reference/post_class#Adding_More_Classes

  7. Lalato
    Member
    Posted 1 year ago #

    Thanks, alchmyth. I'll play around with it. You've been very helpful, and I greatly appreciate it. :)

Topic Closed

This topic has been closed to new replies.

About this Topic