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 … Read more

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’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js’); wp_enqueue_script(‘jq-1.9.1-js’); wp_register_script(‘jq-1.7.1-js’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js’); wp_enqueue_script(‘jq-1.7.1-js’); Plugin JS file: var $j = jQuery.noConflict(); $j(document).ready(function() { // plugin 1 … Read more

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 … Read more

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: http://code.tutsplus.com/tutorials/loading-css-into-wordpress-the-right-way–cms-20402 (this is from “30-Jun-2014”) and this one http://code.tutsplus.com/articles/how-to-include-javascript-and-css-in-your-wordpress-themes-and-plugins–wp-24321 (this is from “14-Feb-2012”) They explain the … Read more

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 … Read more

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 … Read more