$video_image_generated = false; $video_image = $inspiry_single_property->get_video_image(); if (!empty($video_image)) { $video_image_src = wp_get_attachment_image_src($video_image, 'post-thumbnail'); if ($video_image_src) { ?> <img class="img-responsive" src="<?php echo esc_url($video_image_src[0]); ?> " alt="" /><?php $video_image_generated = true; } } /* * Backup in case of no video image */ if (!$video_image_generated) { if (has_post_thumbnail()) { // display featured image if video image is not available the_post_thumbnail('post-thumbnail', array('class' => 'img-responsive')); } else { // display place holder image in case of all above fails inspiry_image_placeholder('post-thumbnail'); } } ?> </a> </div> </section> <?php }
/** * Display thumbnail * @param string $size */ function inspiry_thumbnail($size = 'inspiry-grid-thumbnail') { ?> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { the_post_thumbnail($size, array('class' => 'img-responsive')); } else { inspiry_image_placeholder($size, 'img-responsive'); } ?> </a> <?php }