From ea4b8fa8a825351e62087ef5e4668ee8ce9ed7df Mon Sep 17 00:00:00 2001 From: raikasdev Date: Mon, 25 Sep 2023 15:35:45 +0300 Subject: [PATCH 01/19] Fixed PHP styling with new guidelines and fixed allowed blocks --- functions.php | 3 +-- inc/hooks/gutenberg.php | 4 ++++ inc/includes/nav-walker.php | 4 +--- inc/includes/post-type.php | 1 - inc/includes/taxonomy.php | 1 - inc/taxonomies/your-taxonomy.php | 1 - inc/template-tags/edit-link.php | 1 - inc/template-tags/single-comment.php | 3 ++- phpcs.xml | 11 ++++++----- 9 files changed, 14 insertions(+), 15 deletions(-) diff --git a/functions.php b/functions.php index 893e4529..f653bdcd 100644 --- a/functions.php +++ b/functions.php @@ -137,8 +137,7 @@ // Restrict to only selected blocks // Set the value to 'all' to allow all blocks everywhere 'allowed_blocks' => [ - 'default' => [ - ], + 'default' => [], 'post' => [ 'core/archives', 'core/audio', diff --git a/inc/hooks/gutenberg.php b/inc/hooks/gutenberg.php index 07c47dc1..23524739 100644 --- a/inc/hooks/gutenberg.php +++ b/inc/hooks/gutenberg.php @@ -25,6 +25,10 @@ function allowed_block_types( $allowed_blocks, $editor_context ) { // If there is post type specific blocks, add them to the allowed blocks list if ( isset( $editor_context->post->post_type ) && isset( THEME_SETTINGS['allowed_blocks'][ $editor_context->post->post_type ] ) ) { + if ( 'all' === THEME_SETTINGS['allowed_blocks'][ $editor_context->post->post_type ] ) { + return $allowed_blocks; + } + $allowed_blocks = array_merge( $allowed_blocks, THEME_SETTINGS['allowed_blocks'][ $editor_context->post->post_type ] ); } diff --git a/inc/includes/nav-walker.php b/inc/includes/nav-walker.php index 196b8266..9c3ff71d 100755 --- a/inc/includes/nav-walker.php +++ b/inc/includes/nav-walker.php @@ -106,7 +106,6 @@ public function start_lvl( &$output, $depth = 0, $args = null ) { } else { $output .= "\n{$n}{$indent}