How to dequeue / deregister any theme styles and scripts

Is it possible to some how make my plugin dequeue / deregister any styles and any scripts from what ever theme activated. so it doesn’t matter what theme will be installed the styles and scripts of that theme will be dequeue / deregister? Just to be super clear: I don’t know what theme will be … Read more

Load js/css files only on specific admin UI pages

How do I adapt this solution to work with my plugin? (Please see the link). I enqueue my css and js script as follows: function my_plugin_init() { wp_enqueue_script(‘my_plugin_script’, plugins_url(‘js/the_filepath.js’, __FILE__), array(‘jquery’)); wp_enqueue_style( ‘my_plugin_css’, plugins_url( ‘/css/the_filepath.css’, __FILE__ ) ); } add_action(‘init’, ‘my_plugin_init’); I tried putting this in the theme’s functions.php, but it didn’t work: function remove_my_plugin_extras() … Read more

How to enqueue style before style.css

How do I enqueue a .css file before style.css is loaded? Or make the default style.css dependant on another .css file? I’m trying to load a .css reset, which style.css would overwrite. Here’s what I have: add_action(‘wp_enqueue_scripts’, ‘load_css_files’); function load_css_files() { wp_register_style( ‘normalize’, get_template_directory_uri() . ‘/css/normalize.css’); wp_enqueue_style( ‘normalize’ ); } However this is loaded after … Read more

Why is style.css not being enqueued?

I got a pretty basic theme and just found out my style.css file doesn’t get loaded into the <head>. I already searched around but can’t find out, why it’s not loading. I inspected the global $wp_styles object already but couldn’t find anything: function style_test() { $wp_styles = new WP_Styles(); echo ‘<pre>’; // $wp_styles->enqueue == completely … Read more

Why wp_register_style() is important while I’m using a complete wp_enqueue_style()? [duplicate]

This question already has answers here: When should I use wp_register_script() with wp_enqueue_script() vs just wp_enqueue_script()? (3 answers) Closed 8 years ago. Currently I’m working on a theme, and did some styles and scripts enqueue. When enqueued the scripts, I used wp_register_script() first, and then enqueued with wp_enqueue_script() – because I got that’s the proper … Read more

Check if a script/style was enqueued/registered

Is it possible to test whether a script or a style was registered using wp_register_script/_style or wp_enqueue_script/_style? All functions doesn’t return a value and I’m completely clueless. I need it to switch between different functions depending on stylesheet-libraries and scripts I offer. Thank you! 2 There is a function called wp_script_is( $handle, $list ). $list … Read more

Where is the right place to register/enqueue scripts & styles

I am using WordPress 3.1.4 by now. I am confused with where (which hook) do I use: to register and/or enqueue scripts and styles on front- and back-ends? Questions: Which are right hooks to use? All front end register/enqueue scripts/styles in init? Why is there no admin_print_styles-{xxx}? 1 Why registering and queuing properly matters it … Read more

Enqueue Scripts / Styles when shortcode is present

What is the idea way to register/enqueue scripts and/or styles for use in plugins? I recently made a plugin simple plugin to add the user avatar/gravatar with a shortcode. I have different style options for displaying the avatar (square, round, etc.) and decided to put the css directly in the shortcode itself. However, I realize … Read more