I am using advanced custom fields pro to display an image if the option exists. If the option does not exist then it will look for a post thumbnail. I already have this code and it's working however I want to add an option to display a default image from my images folder if both options do not exist.
Here's the working code I currently have:
<?php if(get_field('photos')): ?>
<div class="img"><?php echo '<a class="image" href="' . get_permalink() . '"><div class="img"><img src="' . $model_pic[0]['sizes']['models'] . '" /></div><div class="info"><h3>' . get_the_title() . '</h3></div> </a> ' ?></div>
<?php else: ?>
<?php $small_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'models'); ?>
<div class="img"><?php echo '<a class="image" href="' . get_permalink() . '"><div class="img"><img src="' . $small_image_url[0] . '"/></div><div class="info"><h3>' . get_the_title() . '</h3></div> </a> ' ?></div>
<?php endif; ?>
I want to add a third else statement to the code so it will display an image from my theme images folder if there is no post thumbnail set.
Something like this: (but this does not work)
<?php if(get_field('photos')): ?>
<div class="img"><?php echo '<a class="image" href="' . get_permalink() . '"><div class="img"><img src="' . $model_pic[0]['sizes']['models'] . '" /></div><div class="info"><h3>' . get_the_title() . '</h3></div> </a> ' ?></div>
<?php elseif ?>
<?php $small_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'models'); ?>
<div class="img"><?php echo '<a class="image" href="' . get_permalink() . '"><div class="img"><img src="' . $small_image_url[0] . '"/></div><div class="info"><h3>' . get_the_title() . '</h3></div> </a> ' ?></div>
<?php else: ?>
echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/thumbnail-default.jpg" />';
<?php endif; ?>