From 321e8abd09dd4b26a268786af336b095e7e17900 Mon Sep 17 00:00:00 2001 From: Sarah Norris <1645628+mikachan@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:41:38 +0000 Subject: [PATCH] Make form files more specific to form page (#480) * Make form styles more specific * Only load form files on CBT page --- admin/create-theme/theme-form.php | 10 ++++++---- admin/css/form.css | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/admin/create-theme/theme-form.php b/admin/create-theme/theme-form.php index c1b0ec8..be4e379 100644 --- a/admin/create-theme/theme-form.php +++ b/admin/create-theme/theme-form.php @@ -276,10 +276,12 @@ class Theme_Form { } public static function form_script() { - wp_enqueue_script( 'form-script', plugin_dir_url( dirname( __FILE__ ) ) . 'js/form-script.js' ); - wp_enqueue_style( 'form-style', plugin_dir_url( dirname( __FILE__ ) ) . 'css/form.css' ); + if ( ! empty( $_GET['page'] ) && 'create-block-theme' === $_GET['page'] ) { + wp_enqueue_script( 'form-script', plugin_dir_url( dirname( __FILE__ ) ) . 'js/form-script.js' ); + wp_enqueue_style( 'form-style', plugin_dir_url( dirname( __FILE__ ) ) . 'css/form.css' ); - // Enable localization in the form. - wp_set_script_translations( 'form-script', 'create-block-theme' ); + // Enable localization in the form. + wp_set_script_translations( 'form-script', 'create-block-theme' ); + } } } diff --git a/admin/css/form.css b/admin/css/form.css index a4ab244..e490437 100644 --- a/admin/css/form.css +++ b/admin/css/form.css @@ -1,12 +1,12 @@ -h2 { +.appearance_page_create-block-theme h2 { margin-bottom: 0; } -p.description { +.appearance_page_create-block-theme p.description { margin-bottom: 1rem; } -.submit { +.appearance_page_create-block-theme .submit { clear: both; }