I am creating something which passes featured image URLs to a separate JavaScript file which uses parallax.js to create a parallax background for each entry for an archive page.
This works fine when each post has an image.
I have been working on having a default image where there is no featured image but am having problems on pointing to it. I want to keep the path relative so when I upload to the host there is no need to have an absolute path.
At the moment it goes something like this:
if ( has_featured_image() ) {
$image_link_url = $featured_background_image;
} else {
$image_link_url = get_template_url() . 'images/placeholder_bg.png';
}
This does not work. How would I get the result I am after? Ideally want to have the function result and string at the end as one single string in a variable.