Can't load my script in WP
-
Hi,
I have been trying to add a scriptto my site that depends on jquery, but I can’t get it to work. Any help would be much appreciated. Thank you.
Here’s what I have in my functions.php:
/*Adds accordion script*/ function accordion_script(){ wp_register_script('accordion', get_template_directory_uri() . 'https://kubetest.kube.co.uk/wp-includes/js/accordion-script.js', 'jquery'); wp_enqueue_script('accordion'); } add_action( 'wp_enqueue_scripts', 'accordion_script');
Here is the contents of accordion-script.js:
$j(document).ready(function(){ var $j = jQuery.noConflict(); $j(function($) { var allPanels = $j('.post-list > li > .entry-summary').hide(); $j('.post-list > li').click(function() { allPanels.slideUp(); $j(this).parent().next().slideDown(); return false; }); })(jQuery); });
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Can't load my script in WP’ is closed to new replies.