First Post Class

add_filter( 'post_class', 'be_first_post_class' );
* First Post Class
* Adds a class of 'first' to the first post
* @author Bill Erickson
* @link
* @param array $classes
* @return array
function be_first_post_class( $classes ) {
global $wp_query;
if( 0 == $wp_query->current_post )
$classes[] = 'first';
return $classes;
view raw hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk