Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This question already has an answer here:

I'm working a custom WordPress site, and I've loaded all the required JavaScript file:

wp_enqueue_script('easing', get_stylesheet_directory_uri() .'/js/diapo/jquery.easing.1.3.js'); 
wp_enqueue_script('minified', get_stylesheet_directory_uri() .'/js/diapo/jquery.hoverIntent.minified.js'); 
wp_enqueue_script('diapo', get_stylesheet_directory_uri() .'/js/diapo/diapo.js'); 
wp_enqueue_script('mobilecustomized', get_stylesheet_directory_uri() .'/js/diapo/jquery.mobile-1.0rc2.customized.min.js');
wp_enqueue_script('startdiapo', get_stylesheet_directory_uri() .'/js/startdiapo.js');

The thing is if I view the site on a browser and I use view source to check if it is part of the html code, it is loaded there. But the problem I'm having is that the JavaScript codes is not performing the actions I want it to. What am I doing wrong?

share|improve this question
1  
Make sure you are properly enqueueing the javascript Samo. If you're just putting that in your header file, that is not correct. See the accepted answer here: wordpress.stackexchange.com/questions/76267/… –  Andrew Bartel May 14 '13 at 1:44
    
thanks Andrew, i've fixed it. –  Samo Adx May 14 '13 at 1:51
add comment

marked as duplicate by toscho May 14 '13 at 9:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

If the files show up in the html source then there is something wrong with your javascript (it may even be as simple as missing a semicolon in the wrong place). Without further information we can't help you.

Beware that wordpress loads jquery in no conflict mode so the function call is jQuery() and not $().

share|improve this answer
    
it is the diapo slider i'm trying to integrate into my word press site pixedelic.com/plugins/diapo i've loaded the css for it <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/diapo.css"> quite well and called the image files in the body of the wordpress code, in the header.php file, where it's supposed to be, i'm not sure what exactly i'm doing wring here. –  Samo Adx May 14 '13 at 1:38
    
thanks a lot Brian, i've fixed it. the problem was that d, i was not pointing it to d wrong files. thanks. –  Samo Adx May 14 '13 at 1:51
    
I'm not familiar with that jQuery plugin but a quick look at the link states that you need to do some javascript/jQuery setup (eg jQuery('selector').diapo();) - are you doing that and are there any javascript errors in that file? –  Brian Barnes May 14 '13 at 1:56
    
yeah Brian, i did that, but instead of me putting the code directly in the page, i placed the code in another file, named the file, then linked to the file with wordpress' code, dat's wat i did with wp_enqueue_script('startdiapo', get_stylesheet_directory_uri() .'/js/startdiapo.js'); for simplicity. –  Samo Adx May 14 '13 at 2:04
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.