Last active
November 26, 2018 01:39
-
-
Save gregrickaby/6189818 to your computer and use it in GitHub Desktop.
Add post count class to WordPress loop
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 | |
// Count the posts and give them each a unqiue number as a css class | |
$count = 1; | |
while ( $query->have_posts() ) : $query->the_post(); $count <= 100; ?> | |
<div class="count-<?php echo $count++; ?>"> | |
<p class="headline"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> | |
</div> | |
<?php endwhile; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment