?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php ob_start(); if (has_post_thumbnail()) { the_post_thumbnail(); } elseif (get_post_format() == 'link') { post_link($post->ID); } elseif (get_post_format() == 'gallery') { post_gallery($post->ID); } elseif (get_post_format() == 'quote') { post_quote($post->ID); } elseif (get_post_format() == 'audio') { post_audio($post->ID); } elseif (get_post_format() == 'video') { post_video($post->ID); } $post_thumbnail = ob_get_contents(); ob_end_clean(); ?> <?php if (!empty($post_thumbnail)) { ?> <div class="post-thumbnail-area">
function ultimatum_custom_loop_image( $args, $instance, $imgw, $rel, $align, $gallery ) { global $post; extract( $args ); $img = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' ); $imgsrc = false; if ( ! $img && $instance["mnoimage"] == 'true' ) { $img[0] = null; if ( get_ultimatum_option( 'general', 'noimage' ) ) { $img[0] = get_ultimatum_option( 'general', 'noimage' ); } $imgsrc = UltimatumImageResizer( null, $img[0], $imgw, $instance["multipleh"], true ); } elseif ( is_array( $img ) ) { $imgsrc = UltimatumImageResizer( get_post_thumbnail_id(), null, $imgw, $instance["multipleh"], true ); } if ( $imgsrc ) { ?> <div class="featured-image <?php echo $align;?>" <?php if ($gallery){ ?>style="position: relative"<?php } ?>> <?php $video = get_post_meta( $post->ID, 'ultimatum_video', true ); if ( $gallery ) { if ( $video ) { $link = $video . ''; } else { $link = $img[0]; if ( preg_match( '/holder.js/i', $imgsrc ) ) { $link = ''; $rel = ''; } } } if ( $instance["mvideo"] == 'true' ) { if ( get_post_meta( $post->ID, '_image_ids', true ) && ! $gallery && $instance['ult_full_image'] ) { post_gallery( $imgw, $instance["multipleh"], $instance ); } elseif ( get_post_meta( $post->ID, 'ultimatum_video', true ) && ! $gallery ) { $sc = '[ult_video width="' . $imgw . '" height="' . $instance["multipleh"] . '"]' . $video . '[/ult_video]'; echo do_shortcode( $sc ); } else { ?> <a href="<?php if ( $gallery ) { echo $link; } else { the_permalink(); } ?>" <?php echo $rel ?> class="preload <?php if ( $gallery ) { echo ' overlayed_image'; } ?>" <?php if ( $gallery ) { if ( $video ) { echo ' data-overlay="play"'; } else { echo ' data-overlay="image"'; } } ?>> <img src="<?php echo $imgsrc; ?>" alt="<?php the_title(); ?>"/> </a><?php } } else { ?> <a href="<?php if ( $gallery ) { echo $link; } else { the_permalink(); } ?>" <?php echo $rel ?> class="preload <?php if ( $gallery ) { echo ' overlayed_image'; } ?>" <?php if ( $gallery ) { if ( $video ) { echo ' data-overlay="play"'; } else { echo ' data-overlay="image"'; } } ?>> <img src="<?php echo $imgsrc; ?>" alt="<?php the_title(); ?>"/> </a><?php } ?> </div><?php } }