How to add jQuery scripts to wordpress?
-
Hi Everyone,
I have a quick question. I have been trying to add jQuery scripts to my site for hours and no luck. I was hoping to find some resolution here. I cannot get my jQuery script to work.
So I have a this code in my functions.php for locating the script file:
function add_my_script() { wp_enqueue_script( 'custom-script', // name your script so that you can attach other scripts and de-register, etc. get_stylesheet_directory_uri() . '/custom_js/jquery_test.js', // this is the location of your script file array('jquery','jquery-ui-core') // this array lists the scripts upon which your script depends , '', true ); } add_action( 'wp_enqueue_scripts', 'add_my_script' );
Then I have this jQuery script:
jquery( document ).ready(function($) { $('img.kad-standard-logo').hide(); });
What is wrong here? Why won’t the effect work on the element I have selected?
FYI I am a big newb!
Thanks in advance,
Emre
- The topic ‘How to add jQuery scripts to wordpress?’ is closed to new replies.