Created
October 19, 2014 22:38
-
-
Save mkormendy/e01dfce8a63e78ebd66b to your computer and use it in GitHub Desktop.
Inserting a class onto the element of the last post of a Wordpress loop.
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 /* The Loop */ ?> | |
<?php $post_counter = 0; | |
while ( have_posts() ) : the_post() ?> | |
<?php $post_counter++; ?> | |
<div id="post-<?php the_ID(); ?>" <?php if( $post_counter == count( $posts ) ) post_class('last-post'); else post_class(); ?>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment