@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage Gutenberg |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -14,38 +14,38 @@ discard block |
||
| 14 | 14 | * Enqueue Admin styles on admin area |
| 15 | 15 | */ |
| 16 | 16 | function load_gutenberg_admin_style() { |
| 17 | - wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0' ); |
|
| 17 | + wp_enqueue_style('admin_css', get_template_directory_uri() . '/assets/css/admin/gutenberg-admin.css', false, '1.0.0'); |
|
| 18 | 18 | } |
| 19 | -add_action( 'admin_enqueue_scripts', 'load_gutenberg_admin_style' ); |
|
| 19 | +add_action('admin_enqueue_scripts', 'load_gutenberg_admin_style'); |
|
| 20 | 20 | |
| 21 | 21 | // Gutenberg Compatibility. |
| 22 | -require_once( get_template_directory() . '/lib/theme-support.php' ); |
|
| 22 | +require_once(get_template_directory() . '/lib/theme-support.php'); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Add custom class for Gutenberg Compatible template |
| 26 | 26 | */ |
| 27 | -function add_gutenberg_compatible_body_class( $classes ) { |
|
| 27 | +function add_gutenberg_compatible_body_class($classes) { |
|
| 28 | 28 | // if ( ! is_home() && ! is_front_page() ). |
| 29 | - if ( is_page() || is_page_template() || is_single() ) |
|
| 29 | + if (is_page() || is_page_template() || is_single()) |
|
| 30 | 30 | $classes[] = 'gutenberg-compatible-template'; |
| 31 | 31 | |
| 32 | 32 | // Add a class if the page is using the Content and Media block. |
| 33 | 33 | $post = get_post(); |
| 34 | - if ( function_exists( 'has_blocks' ) && isset( $post->post_content ) && has_blocks( $post->post_content ) && ( ! is_search() ) && ( ! is_archive() ) ) { |
|
| 35 | - $blocks = parse_blocks( $post->post_content ); |
|
| 34 | + if (function_exists('has_blocks') && isset($post->post_content) && has_blocks($post->post_content) && ( ! is_search()) && ( ! is_archive())) { |
|
| 35 | + $blocks = parse_blocks($post->post_content); |
|
| 36 | 36 | |
| 37 | - if ( 'core/media-text' === $blocks[0]['blockName'] ) { |
|
| 37 | + if ('core/media-text' === $blocks[0]['blockName']) { |
|
| 38 | 38 | $classes[] = 'has-block-media-text'; |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | return $classes; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | -add_filter( 'body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class' ); |
|
| 44 | +add_filter('body_class', __NAMESPACE__ . '\add_gutenberg_compatible_body_class'); |
|
| 45 | 45 | |
| 46 | 46 | // Add custom class for templates that are using the Gutenberg editor. |
| 47 | -add_action('body_class', function( $classes ) { |
|
| 48 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ! is_search() ) && ( ! is_archive() ) ) |
|
| 47 | +add_action('body_class', function($classes) { |
|
| 48 | + if (function_exists('has_blocks') && has_blocks(get_the_ID()) && ( ! is_search()) && ( ! is_archive())) |
|
| 49 | 49 | $classes[] = 'using-gutenberg'; |
| 50 | 50 | return $classes; |
| 51 | 51 | }); |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function add_gutenberg_compatible_body_class( $classes ) { |
| 28 | 28 | // if ( ! is_home() && ! is_front_page() ). |
| 29 | - if ( is_page() || is_page_template() || is_single() ) |
|
| 30 | - $classes[] = 'gutenberg-compatible-template'; |
|
| 29 | + if ( is_page() || is_page_template() || is_single() ) { |
|
| 30 | + $classes[] = 'gutenberg-compatible-template'; |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | // Add a class if the page is using the Content and Media block. |
| 33 | 34 | $post = get_post(); |
@@ -45,7 +46,8 @@ discard block |
||
| 45 | 46 | |
| 46 | 47 | // Add custom class for templates that are using the Gutenberg editor. |
| 47 | 48 | add_action('body_class', function( $classes ) { |
| 48 | - if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ! is_search() ) && ( ! is_archive() ) ) |
|
| 49 | - $classes[] = 'using-gutenberg'; |
|
| 49 | + if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) && ( ! is_search() ) && ( ! is_archive() ) ) { |
|
| 50 | + $classes[] = 'using-gutenberg'; |
|
| 51 | + } |
|
| 50 | 52 | return $classes; |
| 51 | 53 | }); |