jeudi 26 mai 2016

using scripts in a WordPress plugin

I have been given a simple WordPress plugin to maintain. Looking at the code, it calls wp_enqueue_script` to include the scrips it needs.

function my_scripts() {
    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'jquery-1', 'http://ift.tt/1rJStC0', 'jquery', false );
    wp_enqueue_script( 'jquery.validate', 'http://ift.tt/20Fk0Fz', 'jquery', false );
    wp_enqueue_style( 'bootstrap', 'http://ift.tt/1J4cr1i' );     
}

I haven't worked on WordPress plugins before and I am in the process of changing the calls to CDNs to use local files that will be included with the plugin.

I am not sure why the first 2 lines are for JQuery, as my understanding is that JQuery is available by default, so the line that references jquery-1 can be removed.

How do I make sure that WP uses the version of JQuery I want?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire