Created
July 28, 2013 08:29
-
-
Save ovizii/6097943 to your computer and use it in GitHub Desktop.
Add a custom class to the last post in a 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
function last_post_class($classes){ | |
global $wp_query; | |
if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = ‘last’; | |
return $classes; | |
} | |
add_filter(‘post_class’, ‘last_post_class’); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment