wslover317
Member
Posted 7 months ago #
Hi,
Trying to change the layout of the posts (index.php)
I want the first two posts in a 2 col layout
and the third post in a single colum (centered)
and loop accordingly
Example:
Post 1 Post 2
Post 3
Post 4 Post 5
Any ideas?
Thanks in advance!
Bill
add a counter into the loop, and add css classes to the corresponding posts.
structure:
<?php $i = 0; //start counter before the loop
...loop starts...
$i++;
if( $i%3==1 || $i%3==2 ) { $css_class = 'halfwidth'; } elseif( $i%3==0 ) { $css_class = 'fullwidth'; } ?>
<div id="post-<?php the_ID(); ?>" <?php post_class($css_class); ?>>
post div html
</div>
...loop ends...
more detailed suggestions will be easier with your code to build on - if you are interested, please paste the code of your template into a http://pastebin.com/ and post the link to it here
wslover317
Member
Posted 7 months ago #
Here is a link to my current code (index.php)
Code
Generated with Artisteer
What I need is the loop to display the first two posts in two seperate columns, 3rd post in a single column centered underneath (full with) then for the loop to start again. So, 4 and 5th are in two seperate columns, 6th is in one column and so on...
I appreciate your help!
Bill