I have a full width/height header div that I want to use the featured image in, but I'm having trouble getting the div to load a default image if no featured image is set in a blog post.
I figured I could do something like this, but it seems like its still using the first image to load into the div (and not the default img im setting)
<?php
global $post;
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( 5600, 1000 ), false, '' );
?>
<style type="text/css">
.parallax {
background-image: url(<?php echo $src[0]; ?>);
}
</style>
<?php else if( ! has_post_thumbnail() ) : ?>
<style type="text/css">
.parallax {
background-image: url("/wp-content/themes/propertunity/assets/images/backgrounds/highway.jpg") !important;
}
</style>
<?php else : ?>
<?php endif; ?>
what am I doing wrong?