functions.php 407 B

123456789101112131415161718
  1. <?php
  2. /**
  3. * Block Styles.
  4. */
  5. require get_stylesheet_directory() . '/inc/block-styles.php';
  6. /**
  7. * Add class to body if post/page has a featured image.
  8. */
  9. function add_featured_image_class( $classes ) {
  10. global $post;
  11. if ( isset ( $post->ID ) && get_the_post_thumbnail( $post->ID ) ) {
  12. $classes[] = 'has-featured-image';
  13. }
  14. return $classes;
  15. }
  16. add_filter( 'body_class', 'add_featured_image_class' );