Make form files more specific to form page (#480)

* Make form styles more specific

* Only load form files on CBT page
This commit is contained in:
Sarah Norris 2023-11-23 16:41:38 +00:00 committed by GitHub
parent cb5f020671
commit 321e8abd09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -276,10 +276,12 @@ class Theme_Form {
} }


public static function form_script() { public static function form_script() {
wp_enqueue_script( 'form-script', plugin_dir_url( dirname( __FILE__ ) ) . 'js/form-script.js' ); if ( ! empty( $_GET['page'] ) && 'create-block-theme' === $_GET['page'] ) {
wp_enqueue_style( 'form-style', plugin_dir_url( dirname( __FILE__ ) ) . 'css/form.css' ); 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. // Enable localization in the form.
wp_set_script_translations( 'form-script', 'create-block-theme' ); wp_set_script_translations( 'form-script', 'create-block-theme' );
}
} }
} }

View file

@ -1,12 +1,12 @@
h2 { .appearance_page_create-block-theme h2 {
margin-bottom: 0; margin-bottom: 0;
} }


p.description { .appearance_page_create-block-theme p.description {
margin-bottom: 1rem; margin-bottom: 1rem;
} }


.submit { .appearance_page_create-block-theme .submit {
clear: both; clear: both;
} }