Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Created December 15, 2021 23:39
Show Gist options
  • Save kimcoleman/4d251e0b3be4675126d96d3316317e23 to your computer and use it in GitHub Desktop.
Save kimcoleman/4d251e0b3be4675126d96d3316317e23 to your computer and use it in GitHub Desktop.
Add a season-specific class to the body tag.
<?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