Last active
December 17, 2015 16:49
-
-
Save lanche86/5642016 to your computer and use it in GitHub Desktop.
WordPress, while print posts, every fourth has different classname
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php while ( have_posts() ) : the_post(); ?> | |
<?php | |
if ($i % 4 == 3 ) $classname = 'large'; | |
else $classname = 'small'; | |
?> | |
<div class="program-<?php echo $classname; ?>"> | |
<?php the_post_thumbnail( "program-size-$classname", array( "class" => "program-size" ) ); ?> | |
<h3><?php the_title(); ?></h3> | |
<p><?php the_content(); ?></p> | |
<?php $i++; ?> | |
</div> | |
<?php endwhile; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the beginning I used
$i++
(that you never defined, BTW!) and then I realized there is $current_post. ;)