Created
May 10, 2013 16:15
-
-
Save psflannery/5555461 to your computer and use it in GitHub Desktop.
Adds a class to every nth post -- Wordpress
This file contains hidden or 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 if (have_posts()) : ?> | |
<?php $c = 0;while (have_posts()) : the_post(); $c++; | |
if( $c == 3) { | |
$style = 'third'; | |
$c = 0; | |
} | |
else $style=''; | |
// this goes in the loop | |
?> | |
<div <?php post_class($style) ?> id="post-<?php the_ID(); ?>"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment