Created
May 21, 2013 04:39
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* 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