SHARE
TWEET

Untitled

a guest Apr 19th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // add class to body class on single post template
  2. function themeprefix_body_class_blocks( $classes ) {
  3.     if ( is_singular() && has_blocks() ) {
  4.         $classes[] = 'made-with-gutenberg';
  5.     }
  6.     return $classes;
  7. }
  8. add_filter( 'body_class', 'themeprefix_body_class_blocks' );
  9.  
  10.  
  11. // Add class to post classes in blog page or archive pages.
  12. function themeprefix_post_class_blocks( $classes ) {
  13.     if ( is_archive() || is_home() ) {
  14.         if ( has_blocks() ) {
  15.             $classes[] = 'made-with-gutenberg';
  16.         }
  17.     }
  18.     return $classes;
  19. }
  20. add_filter( 'post_class', 'themeprefix_post_class_blocks' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top