Skip to content

Instantly share code, notes, and snippets.

@mrjonwilson
Created May 21, 2013 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrjonwilson/5617515 to your computer and use it in GitHub Desktop.
Save mrjonwilson/5617515 to your computer and use it in GitHub Desktop.
This is how to include jQuery Backstretch in a Genesis by StudioPress child theme: 1. Copy the following gist to your functions.php file. 2. Replace "themename" with the name of your theme.
//* Load Backstretch script and prepare images for loading
add_action( 'wp_enqueue_scripts', 'themename_enqueue_scripts' );
function themename_enqueue_scripts() {
// Load scripts only if custom background is being used
if ( ! get_background_image() )
return;
wp_enqueue_script( 'themename-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'themename-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'converge-backstretch' ), '1.0.0' );
wp_localize_script( 'themename-backstretch-set', 'BackStretchImg', array( 'src' => get_background_image() ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment