Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Olly343434 on "Can't load my script in WP"

$
0
0

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() . 'http://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 all articles
Browse latest Browse all 8245

Trending Articles