Add css class to last post in loop
Use different css styling for your last post. This snippet adds a custom name to the $classes array managed by post_class
/** * Snippet Name: Add css class to last post in loop * Snippet URL: https://wpcustoms.net/snippets/add-css-class-last-post-loop/ */ function wpc_last_post_class($classes){ global $wp_query; if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = 'last'; // change the class name you would like to add here return $classes; } add_filter('post_class', 'wpc_last_post_class');