enqueue admin styling and scripts only on plugin page

You can use $screen = get_current_screen(); functions to get the current screen and add warp your enqueue method with the if conditions to check the screen. https://codex.wordpress.org/Function_Reference/get_current_screen public function enqueue_scripts() { $screen = get_current_screen(); // Check screen base and page if ( ‘options-general’ === $screen->base && $_GET[‘page’] ===’uwc’ ) { wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) … Read more

Child theme style.css versioning

Are you sure the version is included in style.css in the right way? In that case this should really work (hook with wp_enqueue_scripts): $theme_data = wp_get_theme(); wp_register_style(‘your-style-handle’, get_template_directory_uri() . ‘/style.css’, ”, $theme_data[‘version’], ‘all’); wp_enqueue_style(‘your-style-handle’); While developing you may not want to change the file version in style.css all the time, in which case you could … Read more

Enqueue Style for a page/pages only

It should work like this. Sidenotes: I don’t know why you deregister a stylesheet and register it again. Also: get_bloginfo(‘template_directory’) is now replaced by get_template_directory_uri(). Third: Are your folders really named with dots in between? Maybe this causes problems. And maybe your ui stylesheet is an dependency of the main jquery ui stylesheet. You should … Read more

wp_enqueue_style will not let me enforce screen only

I found the answer. Roots has a roots_clean_style_tag that limits everything except print as a media type. I updated mine slightly to just allow screen as well: function roots_clean_style_tag($input) { preg_match_all(“!<link rel=”stylesheet”\s?(id='[^’]+’)?\s+href=”https://wordpress.stackexchange.com/questions/95293/(.*)” type=”text/css” media=”https://wordpress.stackexchange.com/questions/95293/(.*)” />!”, $input, $matches); // Only display media if it’s print if($matches[3][0] === ‘print’){ $media=” media=”print””; } elseif ($matches[3][0] === ‘screen’){ $media=” … Read more