I'm developing a plugin and for that I need jQuery and jQuery datepicker. I's taught that WordPress already enqueued some scripts, and I found 'jquery' and 'jquery-ui-datepicker' there.
Where the datepicker is said to be dependent to jQuery. In that codex page it's also mentioned that, we can call a dependent script like the following:
function my_scripts_method() {
wp_enqueue_script( 'custom-script', plugins_url( '/js/custom_script.js' , __FILE__ ), array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
I got the point is right for any custom script. But what about the default scripts?
What to put on the source ($src) then?
wp_enqueue_script( 'jquery-ui-datepicker', $src, array( 'jquery' ) );
I can't put a null string ('') or a variable, anything, theoretically, and practically.
wp_enqueue_script( 'jquery-ui-datepicker' );if it's a core supplied script. You don't need to tell it anything else.