WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Separate boxes for excerpts? (7 posts)

  1. philfresco
    Member
    Posted 4 years ago #

    I'm sure this question would have been posted somewhere before, but I can't quite name what I'm trying to do in a way that would be suitable for searching the forums...apologies if this is a repeat question. I imagine this is simple to answer anyway:

    I have a very simple theme at the moment, and on my homepage I have a container listing all the excerpts of the most recent posts in chronological order, as most websites do. However, instead of having all the posts in one container, I would like for each post to be broken up into separate boxes.

    Here is an example of what I mean - http://wordpress.org/extend/themes/ahimsa - on the Ahimsa theme, each post on the homepage is in it's own section/box. How do I do that?

    Thanks, Phil.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Site url?

  3. philfresco
    Member
    Posted 4 years ago #

    Sorry, but I've not got the site up at the moment. I know you could really do with seeing what you have to work with, which I why I know you may not be able to answer the question. If you could guess and give me anything to try, it would be greatly appreciated.

    Thanks, Phil.

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Try using something like:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div <?php post_class('postbox');?>>
    [...]
    </div>
    <?php endwhile; ?>

    That should provide you with a class called "postbox" that you can then style via CSS.

  5. philfresco
    Member
    Posted 4 years ago #

    Looking at my code, I actually do have basically the same code that you gave me above. I am able to style the "postbox" via CSS, but I can't seem to style it so that there's a gap in-between the individual posts. I just need to have a 10px gap in-between each post, where the background of the page shows through. At the moment, I have one central div box with the loop in it, so all of the posts are displayed in one styled box in a list. However, I would like each post to be separated up into their own boxes, kind of like a divider; so the desired effect is that there's a box with a border on it with the first post, then a 10px gap, then another box with a border on it with the second post in it, then another 10px gap, then so on. I tried adding a 10px margin to the "postbox", however it only made a white space in-between the posts, and didn't spilt the box up (as I thought it would do). I just can't seem to think of a way to do it!

    Any more ideas? Thanks, Phil.

  6. Gisha James
    Member
    Posted 4 years ago #

    Check whether this is what you are looking for

    Adding separate boxes for posts

  7. philfresco
    Member
    Posted 4 years ago #

    Thanks for the link GJames, it did the trick! This is exactly what I was trying to search for, but it just didn't show up in search engines!

    And also thank you esmi for helping.

    Thanks, Phil.

Topic Closed

This topic has been closed to new replies.

About this Topic