Seriously, I lost my whole day with this... Either I completely missed the point... Or I really cannot find the proper information on the internet...
Everywhere I find they say to load jQuery in the following way, in my main file of my plugin I do the following
This is the wp_enqueue_scripts (with an S) to load the scripts
add_action('wp_enqueue_scripts', 'myplugin_load_jquery');
Then you need the function that calls for jQuery (wp_enqueue_script no S for this one).
function myplugin_load_jquery(){
wp_enqueue_script('jquery');
};
What am I missing,
After doing that, I'm trying to use the following, and it always gives me the message "Call to undefined function jQuery()"
jQuery(document).ready(function(){
//Do anything...
});
Can anyone finally tell me how to do that properly? In a clear manner? Or point me somewhere with proper and clear information?
Do I absolutely need to put my scripts inside a .JS file? Or I can run it from the same file?
... Working now... Doing more tests