Home › Forums › Support › Changing the Styling for Latest Post via Child Theme › Reply To: Changing the Styling for Latest Post via Child Theme
December 4, 2014 at 1:58 pm
#51302
Tom
Lead Developer
Lead Developer
Hi Michael,
How about adding a class to the first post in the loop using a function?
add_filter( 'post_class', 'generate_first_post_class' );
function generate_first_post_class( $classes ) {
global $wp_query;
if( 0 == $wp_query->current_post ) :
$classes[] = 'first';
endif;
return $classes;
}
Then you can target that first post easily.
Let me know 🙂