Title: Using with Backstretch.js?
Last modified: August 21, 2016

---

# Using with Backstretch.js?

 *  [daveerin](https://wordpress.org/support/users/daveerin/)
 * (@daveerin)
 * [12 years ago](https://wordpress.org/support/topic/using-with-backstretchjs/)
 * Hi,
 * Currently in my theme, backstretch.js pulls the image info from the featured 
   image to display as the background. I want this to continue, but i want a second
   featured image to display when people share the posts on social networks.
 * The easiest way, I think, is to change it so the backstretch pulls the image 
   from the second featured image instead and the social networks do their normal
   thing of taking the first featured image.
 * My question is,.. what do I change so backstretch looks for the second image 
   instead of the first? The current code relating to this is this.. I’m pretty 
   sure just one bit needs changing, but I am having no luck. I thought you may 
   spot it in a couple of seconds.
 * Thanks.
 *     ```
       if ( is_singular() ) {
       		wp_enqueue_script( 'backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/jquery.backstretch.min.js', array( 'jquery' ), '1.0.0' );
       wp_enqueue_script( 'backstretch-set3', get_bloginfo('stylesheet_directory').'/js/backstretch-set3.js' , array( 'jquery', 'backstretch' ), '1.0.0' );
       wp_localize_script( 'backstretch-set3', 'BackStretchImg', array( 'src' => wp_get_attachment_url( get_post_thumbnail_id() ) ) );
       		}
   
       }
   
       //* Localize backstretch script
       add_action( 'genesis_after_entry', 'ambiance_set_background_image' );
       function ambiance_set_background_image() {
   
       	$image = array( 'src' => has_post_thumbnail() ? genesis_get_image( array( 'format' => 'url' ) ) : '' );
   
       	wp_localize_script( 'ambiance-backstretch-set', 'BackStretchImg', $image );
   
       }
       ```
   
 * [https://wordpress.org/plugins/dynamic-featured-image/](https://wordpress.org/plugins/dynamic-featured-image/)

Viewing 1 replies (of 1 total)

 *  [marybaum](https://wordpress.org/support/users/marybaum/)
 * (@marybaum)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/using-with-backstretchjs/#post-4884297)
 * Have you posted this in the StudioPress forums?

Viewing 1 replies (of 1 total)

The topic ‘Using with Backstretch.js?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/dynamic-featured-image_444643.svg)
 * [Dynamic Featured Image](https://wordpress.org/plugins/dynamic-featured-image/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dynamic-featured-image/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dynamic-featured-image/)
 * [Active Topics](https://wordpress.org/support/plugin/dynamic-featured-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dynamic-featured-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dynamic-featured-image/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [marybaum](https://wordpress.org/support/users/marybaum/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/using-with-backstretchjs/#post-4884297)
 * Status: not resolved