Created
January 5, 2019 09:07
-
-
Save Tsunamijaan/072e72390d1a61aa834d65cbc9a6af60 to your computer and use it in GitHub Desktop.
Add a Special Class for the First Post in the Loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'post_class', 'post_class_example' ); | |
| function post_class_example( $classes ) { | |
| global $wp_query; | |
| if ( 0 == $wp_query->current_post ) { | |
| $classes[] = 'first-post'; | |
| } | |
| return $classes; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment