Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling box #56

Merged
merged 10 commits into from
Apr 11, 2024
Empty file.
Empty file.
17 changes: 17 additions & 0 deletions public/assets/css/custom-field-styles.css
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than being a standalone CSS file, this should be in admin/assets/css/admin.css with the other CSS that applies to the admin UI. But, as I was the only frontend dev on this plugin for nearly 10 years, I have a weird sass compiler in use that you don't have access to. If you want to add your code to admin/assets/sass/admin.scss, I can compile it before this PR merges in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NatalieMac I will add my code to admin/assets/sass/admin.scss.
Just to make sure, should I remove the add_action hook and the function used to enqueue a stylesheet I added before ?

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#moreinfo_metabox .cmb-field-list .cmb-row {
width: 50%;
}

#moreinfo_metabox .cmb-field-list .cmb-row:last-child {
width: 100%;
}

@media screen and (max-width: 992px) {
#moreinfo_metabox .cmb-field-list {
flex-direction: column;
}

#moreinfo_metabox .cmb-field-list .cmb-row {
width: 100%;
}
}
2 changes: 2 additions & 0 deletions public/class-drawattention.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the public-facing code for the front end of the website. The admin code is in admin/class-drawattention-admin.php. You'll see the other 'admin_enqueue_scripts' hooks in that file. We would also want to include the plugin slug prepended to the name of the style.

Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private function __construct() {

// Load public-facing style sheet and JavaScript.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );

// Shortcode for displaying the image map
Expand Down Expand Up @@ -313,6 +314,7 @@ public function load_plugin_textdomain() {
*/
public function enqueue_styles() {
wp_register_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'assets/css/public.css', __FILE__ ), array(), self::VERSION );
wp_enqueue_style( '-custom-field-styles', plugins_url( 'assets/css/custom-field-styles.css', __FILE__ ), array(), self::VERSION );
}

/**
Expand Down
Loading