From 96b56af05d4314df3cf7e24d820d4f35192a1ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 20 Feb 2024 09:33:29 +0100 Subject: [PATCH 1/4] fix remove pre version 6.0 filter --- themes/10up-theme/includes/blocks.php | 28 --------------------------- 1 file changed, 28 deletions(-) diff --git a/themes/10up-theme/includes/blocks.php b/themes/10up-theme/includes/blocks.php index 05d9ca3..b4d195e 100644 --- a/themes/10up-theme/includes/blocks.php +++ b/themes/10up-theme/includes/blocks.php @@ -44,15 +44,6 @@ function setup() { * @return void */ function register_theme_blocks() { - global $wp_version; - - $is_pre_wp_6 = version_compare( $wp_version, '6.0', '<' ); - - if ( $is_pre_wp_6 ) { - // Filter the plugins URL to allow us to have blocks in themes with linked assets. i.e editorScripts - add_filter( 'plugins_url', __NAMESPACE__ . '\filter_plugins_url', 10, 2 ); - } - // Register all the blocks in the theme if ( file_exists( TENUP_THEME_BLOCK_DIST_DIR ) ) { $block_json_files = glob( TENUP_THEME_BLOCK_DIST_DIR . '*/block.json' ); @@ -83,27 +74,8 @@ function register_theme_blocks() { register_block_type_from_metadata( $block_folder, $block_options ); }; }; - - if ( $is_pre_wp_6 ) { - // Remove the filter after we register the blocks - remove_filter( 'plugins_url', __NAMESPACE__ . '\filter_plugins_url', 10, 2 ); - } } -/** - * Filter the plugins_url to allow us to use assets from theme. - * - * @param string $url The plugins url - * @param string $path The path to the asset. - * - * @return string The overridden url to the block asset. - */ -function filter_plugins_url( $url, $path ) { - $file = preg_replace( '/\.\.\//', '', $path ); - return trailingslashit( get_stylesheet_directory_uri() ) . $file; -} - - /** * Enqueue editor-only JavaScript/CSS for blocks. * From 976b2cb2d5cff73f851c6bc5ac464a1a7739c8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 20 Feb 2024 09:33:53 +0100 Subject: [PATCH 2/4] fix remove whitespaces --- themes/10up-theme/includes/blocks.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/themes/10up-theme/includes/blocks.php b/themes/10up-theme/includes/blocks.php index b4d195e..991fba4 100644 --- a/themes/10up-theme/includes/blocks.php +++ b/themes/10up-theme/includes/blocks.php @@ -20,9 +20,7 @@ function setup() { }; add_action( 'enqueue_block_editor_assets', $n( 'blocks_editor_styles' ) ); - add_action( 'init', $n( 'register_theme_blocks' ) ); - add_action( 'init', $n( 'register_block_pattern_categories' ) ); /* From 22f1081b3ebac0bfe222155ed6a56799b8ae9a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 20 Feb 2024 09:34:10 +0100 Subject: [PATCH 3/4] fix remove reference of block library --- themes/10up-theme/includes/blocks.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/themes/10up-theme/includes/blocks.php b/themes/10up-theme/includes/blocks.php index 991fba4..acf3bae 100644 --- a/themes/10up-theme/includes/blocks.php +++ b/themes/10up-theme/includes/blocks.php @@ -22,18 +22,6 @@ function setup() { add_action( 'enqueue_block_editor_assets', $n( 'blocks_editor_styles' ) ); add_action( 'init', $n( 'register_theme_blocks' ) ); add_action( 'init', $n( 'register_block_pattern_categories' ) ); - - /* - If you are using the block library, remove the blocks you don't need. - - add_filter( 'tenup_available_blocks', function ( $blocks ) { - if ( ! empty( $blocks['integrated-hero'] ) ) { - unset( $blocks['integrated-hero'] ); - } - - return $blocks; - } ); - */ } /** From a224992c7528d6f94129be2f4c7c2f859034c7bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 20 Feb 2024 09:36:39 +0100 Subject: [PATCH 4/4] fix remove polyfill of wp_body_open hook --- themes/10up-theme/functions.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/themes/10up-theme/functions.php b/themes/10up-theme/functions.php index 72cb6b4..718669a 100755 --- a/themes/10up-theme/functions.php +++ b/themes/10up-theme/functions.php @@ -39,13 +39,3 @@ if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { require_once __DIR__ . '/vendor/autoload.php'; } - -if ( ! function_exists( 'wp_body_open' ) ) { - - /** - * Shim for the new wp_body_open() function that was added in 5.2 - */ - function wp_body_open() { - do_action( 'wp_body_open' ); - } -}