I have a new WP_Query on my archive page. I also have a post_class filter conditionally adding a class of first
so I can display them in rows of 3 reliably.
This is the post_class filter
function sm_inline_post_class( $classes ) {
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
$classes[] = 'first';
return $classes;
}
add_filter( 'post_class', 'sm_inline_post_class' );
This works fine for the default query, but the first
class does not get applied to the posts from my custom query.
How do you conditionally apply post classes to entries from custom queries?