Created
December 15, 2021 23:39
-
-
Save kimcoleman/4d251e0b3be4675126d96d3316317e23 to your computer and use it in GitHub Desktop.
Add a season-specific class to the body tag.
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
<?php | |
/** | |
* Add a season-specific class to the body tag. | |
* | |
*/ | |
function stranger_studios_season_body_class( $classes ) { | |
$months_winter = array( 1, 2, 11, 12 ); | |
if ( in_array( date( 'm' ), $months_winter ) ) { | |
$classes[] = 'body_winter'; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'stranger_studios_season_body_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment