David Stockdale's Scrapcode

Enqueing Scripts In A Genisis Child Theme

Just managed to implement my solution for NumScroller on Tees Valley Arts website and of course their site had to be awkward.

Apparently a Genesis Child Theme requires a few more parameters when calling “wp_enqueue_script” than the Beans Theme.

/**
 * Adds script (David Stockdale).
 */
add_action( 'wp_enqueue_scripts', 'add_my_script' );
/**
 * Adds script for NumScroller (David Stockdale).
 */
function add_my_script() {
	wp_enqueue_script(
		'numscroller-1.0', // name your script so that you can attach other scripts and de-register, etc.
		get_stylesheet_directory_uri() . 
		'/lib/numscroller-1.0.js', // this is the location of your script file.
		array( 'jquery' ), // this array lists the scripts upon which your script depends
		'', //Not needed with Beans.
		true //Not needed with Beans.
	);
}

Leave a Reply