I am trying to build a site (blog) that mimics the layout of the new www.digg.com site.
It consist of a top featured full width post and below that the post are in 3 column wide blocks. The blocka all are set to a certain width and Float left.
The difference in the one I am building is instead of just the top post being a featured full width post, any row can have a featured post shown which should expand the full width of the page and push the other blocks down.
The problem is, if a post is designated as being featured and it is not in the left column, then it will not look right. The image below illustrates what happens if a featured post is in the 2nd or 3rd column.
Traversing a WHILE loop of Wordpress posts, I count and assign a number between 1 and 3 to each posts CSS class. example <div class="col-1"> <div class="col-2"> <div class="col-3">
col-1 = left column post
col-2 = middle column post
col-3 = right column post
Occasionally a post will also have a CSS class named featured. When a post is designated as featured then it will expand the full width of 3 columns instead of just 1 column.
This is all easy to do as long as the featured post is the very first post in the result set. However, in the image below I have showed where my problem is. If I assign a class column name of 1-3 for each post and a class name of featured for featured posts, then assuming I am iterating the set and I assign a featured CSS class to a post that would normally have a class name of col-2 or col-3 then there is a problem.
The image below shows the problem. On row 3, you can see what would happen if I assigned a featured class to the row 3 center column (col-2)

I need to somehow, assign class name col-1 col-2 col-3 or featured to all posts in the while loop and make sure that the featured post are always in the column-1 position.
I am open to any suggestions or help on how I could achieve this?
Below is a sample code of the PHP loop... (NOTE: I did not add in the code to check for Featured posts yet)
<?php
// Start our column count at 1
$column = 1;
while (have_posts()) : the_post();
$col_class = 'post-col-' .$column;
?>
<article <?php post_class($col_class); ?>>
post content
</article>
<?php
// Increase the Column count
$column++;
// After count has displayed 3, we reset the count
if($column == 4){
$column = 1;
}
endwhile;
?>
float: leftyou can useclear: bothon the featured items' css to achieve this.