Skip to main content
added 54 characters in body
Source Link
onetrickpony
  • 13.6k
  • 7
  • 59
  • 87

assuming you're using post_class()post_class():

add_filter('post_class', 'my_post_class');
function my_post_class($classes){
  global $wp_query; 

  if(($wp_query->current_post+1>current_post + 1) == $wp_query->post_count)
    $classes[] = 'last'; 

  return $classes;
});

assuming you're using post_class():

add_filter('post_class', 'my_post_class');
function my_post_class($classes){
  global $wp_query;
  if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = 'last';
  return $classes;
}

assuming you're using post_class():

add_filter('post_class', function($classes){
  global $wp_query; 

  if(($wp_query->current_post + 1) == $wp_query->post_count)
    $classes[] = 'last'; 

  return $classes;
});
Source Link
onetrickpony
  • 13.6k
  • 7
  • 59
  • 87

assuming you're using post_class():

add_filter('post_class', 'my_post_class');
function my_post_class($classes){
  global $wp_query;
  if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = 'last';
  return $classes;
}