using wp_enqueue_script correctly
-
ok so yesterday I purchased a premium slider plugin and loaded it up and everything worked fine, then I went on to try to ‘properly’ insert my own js with the wp_enqueue_script method and although I got my own js to work, the slider has stopped working. I contacted the author of the premium slider plugin and he says I am not properly using wp_enqueue_script and that is what is causing the conflict. When i look on wordpress for the documentation and forums for the wp_enqueue_script I dont fully understand how to pull this off. (Newbie with developing with wordpress but knowledgable in the old school static way) so below is what I have in the following files. Obviously this is not correct so could someone provide me an example of what I would do for this? (I’m better with seeing actual code with notes), it is as follows:
In my functions.php
function my_bg_fade_script() { wp_enqueue_script( 'jquery-fade', get_template_directory_uri() . '/js/jquery.fade.js', array('jquery') ); } add_action('wp_enqueue_scripts', 'my_bg_fade_script');
function my_custom_bg_script() { wp_enqueue_script( 'jquery-1-2-6-min', get_template_directory_uri() . '/js/jquery-1.2.6.min.js', array('jquery') ); } add_action('wp_enqueue_scripts', 'my_custom_bg_script');
function my_custom_bg_script_2() { wp_enqueue_script( 'jquery-bgpos', get_template_directory_uri() . '/js/jquery.bgpos.js', array('jquery') ); } add_action('wp_enqueue_scripts', 'my_custom_bg_script_2');
Then in my header.php is:
<?php wp_enqueue_script("jquery"); ?> <?php wp_head(); ?>
I have been working with this for two days now and spent entirely too much time on it, any help you can provide will be MUCH appreciated! Thanks
[ Please do not bump, it’s not permitted here. ]
- The topic ‘using wp_enqueue_script correctly’ is closed to new replies.