Add body class to WordPress posts without featured image
This file contains 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 body class to posts without featured image | |
* | |
*/ | |
function add_body_class_no_featured_image( $classes ) { | |
if(is_single() && !has_post_thumbnail()) { | |
$classes[] = 'no-featured-image'; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class','add_body_class_no_featured_image' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment