Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  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' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement