Articles of wp register style

Register script/style: Is it possible to customize the version query string via plugin?

Expanding on the question in the title: I would like to find a way (via a plugin) to use timestamps for the JS and CSS file version query strings that are output with wp_register_style and wp_register_script. I know this can be easily modified in the calls themselves, and I do it this way currently: $style_mtime […]

Using wp_register_style to load CSS in footer?

I realise you can enqueue JS in the footer using wp_register_script as there is a $in_footer parameter for doing so. However, there isn’t one for wp_register_style it seems. Is there a way to enqueue CSS in the footer in the same way, or do I have to manually hardcode the file path in my footer.php […]

Changes in enqueued / registered stylesheet paths not updating—why?

I’m attempting to modify a WordPress theme so that it appends a version number to a particular stylesheet. This is all done on a local development machine, tested on a staging server, too, for good measure. Following the instructions here:, I added filemtime( get_template_directory() . ‘/css/main.css’ ) into the arguments passed through wp_register_style From: […]

The correct way to include JavaScript and CSS in my WordPress Themes

I’m trying to build my own WordPress theme using the correct ways. But… The first trouble that I found was how to add css and js “using the correct way”. I found severals tutorials how to do it. e.x:–cms-20402 (this is from “30-Jun-2014”) and this one–wp-24321 (this is from “14-Feb-2012”) They explain the […]

Best spot for wp_register_script() and wp_register_style()

I need to enqueue multiple scripts and styles in my plugin. However, I do not like the idea of calling wp_register_script() and wp_register_style() every time I need to call wp_enqueue_script() and wp_enqueue_style(). I think it is a good idea to register the scripts and styles once, then call them as necessary as needed. So my […]

WP deregister, register and enqueue dequeue

a plugin that I bought is loading a few js and css files on all pages, so I wanted to write a new function to deregister the handles, and enqueu them where I wanted. however I am not sure If I have to deregister => register and then enqueue. or do I just dequeue them […]

Naming script handles right way

I was wondering is there any convention or what is the right way for naming handles in wp_register_script() and wp_register_style() functions? For example if I am developing a plugin that uses modernizer, is it better simply naming it ‘modernizer’ or something unique like ‘my-script-modernizer’? If it is better to have unique handles and I am […]

Using multiple versions of jQuery while still calling it like WP likes

I have two JS plugins inside my plugin. One uses jQuery 1.7.1 and the other 1.9.1. I need to have each of them use different version. This is how things are at the moment: Plugin php file: wp_register_script(‘jq-1.9.1-js’, ‘’); wp_enqueue_script(‘jq-1.9.1-js’); wp_register_script(‘jq-1.7.1-js’, ‘’); wp_enqueue_script(‘jq-1.7.1-js’); Plugin JS file: var $j = jQuery.noConflict(); $j(document).ready(function() { // plugin 1 […]

wp_deregister_style with md5 variable?

I want to deregister Google Fonts to defer the loading. The style id is dynamic. wp_enqueue_style( ‘theme-google-fonts-‘ . md5( $google_font_url ), $google_font_url, array() ); How can I deregister or dequeue a function like that? Thanks!!

Load custom css after bootstrap

I have this in functions.php. How can I modify it so that my custom css is loaded after bootsrap.min.css? function register_css() { wp_register_style( ‘bootstrap.min’, get_template_directory_uri() . ‘/css/bootstrap.min.css’ ); wp_enqueue_style( ‘bootstrap.min’ ); } add_action( ‘wp_enqueue_scripts’, ‘register_css’ ); I found this but it doesn’t work and I don’t know much about php but I think it’s missing […]