All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

Use Featured Image for backstretch.js

  • # June 18, 2013 at 9:44 am

    I’m using [backstretch.js]( “”) for full-width header images on my pages. I’m able to grab the Featured Image url like this:

    < ?php $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), ‘full’, false, ”); echo $src[0]; ?>

    Does anyone know of a way to pass this url to my main.js file?

    $(“.cover”).backstretch(“FEATURED_IMG_URL_WOULD_GO_HERE”); // backstretch.js

    Thinking it might be possible to store the PHP in a variable, though I’m not so sure.

    Thanks in advance. Any help is appreciated!

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed