From 143fd4c1f71fe7d5f6bd7b64c491d9644d861355 Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Thu, 29 Sep 2022 18:55:10 +0000 Subject: [PATCH] Editor: Reintroduce styles that were removed for classic themes. After block CSS was merged with `theme.json` styles in [https://github.com/WordPress/gutenberg/pull/34180 Gutenberg PR #34180], this removed some existing, default styling for some elements, including buttons. This change re-adds the removed styles by enqueueing `classic.css` for classic themes. Merges [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR #44334] into trunk. Follow-up to [54257]. Props scruffian, oandregal, ramonopoly, aristath, andrewserong, get_dave, bernhard-reiter. See #56467. Built from https://develop.svn.wordpress.org/trunk@54358 git-svn-id: http://core.svn.wordpress.org/trunk@53917 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/default-filters.php | 2 ++ wp-includes/script-loader.php | 13 +++++++++++++ wp-includes/version.php | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index 126d276417..725f5ef3cb 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -557,8 +557,10 @@ add_action( 'wp_default_scripts', 'wp_default_packages' ); add_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); add_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' ); +add_action( 'wp_enqueue_scripts', 'wp_enqueue_classic_theme_styles' ); add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); add_action( 'admin_enqueue_scripts', 'wp_common_block_scripts_and_styles' ); +add_action( 'admin_enqueue_scripts', 'wp_enqueue_classic_theme_styles' ); add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' ); add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 ); add_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_and_styles' ); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 3bd0bbcaf2..0c64281843 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -3640,3 +3640,16 @@ function _wp_theme_json_webfonts_handler() { add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles ); add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles ); } + +/** + * Loads classic theme styles on classic themes. + * + * This is needed for backwards compatibility for button blocks specifically. + */ +function wp_enqueue_classic_theme_styles() { + if ( ! wp_is_block_theme() ) { + $suffix = wp_scripts_get_suffix(); + wp_register_style( 'classic-theme-styles', "/wp-includes/css/dist/block-library/classic$suffix.css", array(), true ); + wp_enqueue_style( 'classic-theme-styles' ); + } +} diff --git a/wp-includes/version.php b/wp-includes/version.php index fdcd857993..531e26a0b3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-beta2-54357'; +$wp_version = '6.1-beta2-54358'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.