echo esc_attr('columns-' . $kt_related_colums . " layout-" . $kt_blog_layout); ?> "> <?php while ($new_query->have_posts()) { $new_query->the_post(); ?> <li class="<?php echo esc_attr(implode(' ', $item_class)); ?> "> <?php if ($kt_blog_placehold == "yes" || has_post_thumbnail()) { ?> <?php $thumb = kt_resize_image(get_post_thumbnail_id(), wp_get_attachment_thumb_url(), $thumb_w, $thumb_h, $crop, true, false); ?> <?php if ($thumb['url']) { ?> <div class="post-thumbnail"> <a class="banner-opacity" href="<?php the_permalink(); ?> "> <img src="<?php echo esc_url($thumb['url']); ?> " alt=""/> </a> </div>
function kt_post_thumbnail() { $thumb_class = array(); global $kt_blog_layout, $kt_blog_list_style, $kt_blog_list_columns; $kt_blog_placehold = kt_option('kt_blog_placehold', 'no'); if ($kt_blog_placehold == 'no' && !has_post_thumbnail()) { return false; } $crop = false; if ($kt_blog_layout == 'full') { $thumb_w = 1170; $thumb_h = 820; $crop = false; } else { $thumb_w = 870; $thumb_h = 609; $crop = false; } if (($kt_blog_list_style == 'grid' || $kt_blog_list_style == 'masonry') && $kt_blog_layout == 'full') { if ($kt_blog_list_columns == 5) { $thumb_w = 234; $thumb_h = 177; } if ($kt_blog_list_columns == 4) { $thumb_w = 292; $thumb_h = 221; } if ($kt_blog_list_columns == 3) { $thumb_w = 370; $thumb_h = 280; } if ($kt_blog_list_columns == 2) { $thumb_w = 585; $thumb_h = 443; } if ($kt_blog_list_style == 'grid') { $crop = true; } } elseif (($kt_blog_layout == 'left' || $kt_blog_layout == 'right') && ($kt_blog_list_style == 'grid' || $kt_blog_list_style == 'masonry')) { if ($kt_blog_list_columns == 5) { $thumb_w = 292; $thumb_h = 221; } if ($kt_blog_list_columns == 4) { $thumb_w = 292; $thumb_h = 221; } if ($kt_blog_list_columns == 3) { $thumb_w = 292; $thumb_h = 221; } if ($kt_blog_list_columns == 2) { $thumb_w = 435; $thumb_h = 329; } $crop = true; } if ($kt_blog_list_style == 'masonry') { $crop = false; } if (is_single()) { if ($kt_blog_layout == 'full') { $thumb_w = 1170; $thumb_h = 820; $crop = false; } else { $thumb_w = 870; $thumb_h = 610; $crop = false; } } if ($kt_blog_list_style == 'grid' || $kt_blog_list_style == "masonry" || is_single()) { $thumb_class[] = 'banner-opacity'; } else { $thumb_class[] = 'gray'; } if (is_single()) { $thumb_class = array('gray'); } $image = kt_resize_image(get_post_thumbnail_id(), null, $thumb_w, $thumb_h, $crop, true, false); ?> <div class="post-thumbnail"> <a class="<?php echo esc_attr(implode(' ', $thumb_class)); ?> " href="<?php the_permalink(); ?> "> <img width="<?php echo esc_attr($image['width']); ?> " height="<?php echo esc_attr($image['height']); ?> " class="attachment-post-thumbnail wp-post-image" src="<?php echo esc_attr($image['url']); ?> " alt="<?php the_title(); ?> " /> </a> </div> <?php }