Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // add class to body class on single post template
- function themeprefix_body_class_blocks( $classes ) {
- if ( is_singular() && has_blocks() ) {
- $classes[] = 'made-with-gutenberg';
- }
- return $classes;
- }
- add_filter( 'body_class', 'themeprefix_body_class_blocks' );
- // Add class to post classes in blog page or archive pages.
- function themeprefix_post_class_blocks( $classes ) {
- if ( is_archive() || is_home() ) {
- if ( has_blocks() ) {
- $classes[] = 'made-with-gutenberg';
- }
- }
- return $classes;
- }
- add_filter( 'post_class', 'themeprefix_post_class_blocks' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement