WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category post grid (3 posts)

  1. EntarteteMuzak
    Member
    Posted 3 years ago #

    Hi,

    I need to display posts from a category in a grid that looks like this:

    POST1 | POST2 | POST3
    ____________________

    POST4 | POST5 | POST6
    ____________________

    POST7 | POST8 | POST9
    ____________________

    How do I add a border after the first three posts?
    Sure I can do it with a background-image, but that is not flexible add not bulletproof.

    How do I put a border on just POST2 in every row?
    I guess I can fix it with a negative marginal in CSS, but that isn't really that neat.

    Thoughts?

  2. EntarteteMuzak
    Member
    Posted 3 years ago #

    Solved the bottom border thing with this bit of code:

    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
    <?php if ($count%3== 0) : ?>
    
    // make with the usual article content
    //and do something under every third post
    
    <?php else : ?>
    
    // make with the usual article content
    
    <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>

    Kudos to:
    http://wordpress.org/support/topic/how-to-show-code-after-x-amount-of-posts

    Now it's just the left and right borders....

  3. EntarteteMuzak
    Member
    Posted 3 years ago #

    Duh!
    Just add border-right css to post 1 and 2.

Topic Closed

This topic has been closed to new replies.

About this Topic