posts showing in same div Wordpress

All my posts are showing in the same div, rather than seperate ones,

<?php get_header(); ?>
 <div class="mainwrap">
 <div class="bloginner">
 <!-- begin section -->           

<section>
    <div class="postswrap">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="commentsetall"><img src="<?php bloginfo('template_url'); ?>/images/ico_folder.png" alt="Posted" /><span class="commentfix"><?php the_time('F j, Y') ?> in <?php the_category(', ') ?> by <?php the_author() ?></span></div>
    <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    <div class="clearfix"></div>
    </div>

</section>
<!-- end section -->
 </div> 
<div class="clearfix"></div>
</div>
<?php get_footer(); ?>

Is there a clearfix im maybe missing to stop this from happening?

thanks

Solutions

put the <div class="postswrap"> inside the loop.something like that:

       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 <div class="postswrap">
        <div class="commentsetall"><img src="<?php bloginfo('template_url'); ?>/images/ico_folder.png" alt="Posted" /><span class="commentfix"><?php the_time('F j, Y') ?> in <?php the_category(', ') ?> by <?php the_author() ?></span></div>
        <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
        <?php endwhile; else: ?>
        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<div class="clearfix"></div>
        </div>        
<?php endif; ?>

Similar questions

Wrap every 3 posts in a div (without empty div)
The following code inserts a div every 3 posts. But if there are 3 posts, an empty div is added. How do I prevent the empty div? Thanks
insert div every 2 posts without empty div
I'm pulling my hair out with this! The following code correctly inserts a div with row as the class every 2 posts. HOwever, when there's an even number of posts, it displays an extra empty div below. Can anyone help please? Thanks!
How can I split loop into 2 different div and pass 3 posts per div and repeat it untill end
Suppose I have 2 HTML div named div1 and div2. I wanted to pass the 1st,2nd,3rd post into div1 and 4th,5th,6th post in div2. and next 3 will go in div1 and next 3 will go in div2 and this will continue until the end <div class="sitecontainer"> <div class="tips-and-news-wrap left-containrer"> <...
Two posts in same div - WP loop
I would need the following in Wordpress: I know how to get posts with WP loop, but how can I wrap every two posts in .posts-wrapped div? I fetch the posts with WP_Query. Thanks! EDIT: So I tried few ways to do it. For example with this: But this prints one extra empty posts-wrapped div: How can i get rid of this last empty div? It screws my carouse...
Display div only if exists other posts with same custom field value
I've got a wordpress theme with a set of custom fields. One of these is named "author". On single.php I've got a div which show the other posts with the same custom field value. I would like to display this div only if exists other posts with the same custom field value, else I would like to display nothing. Thanks for your help!! This is my actual...
Show posts and image in same div
I have featured images shown for different posts of same category in a page in a specific div. I need to show the whole post related to this image in the same page in another div. I know i must use JavaScript in this. But i need some reference which i can use for this. Can anyone help me with this? I am using the following code to show the images T...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.