function get_post_images($post_id) { $attachments = get_post_attachments($post_id); $images = array(); // The featured image must be get separately // - if the featured image is already added to the Media Library the duplicates will be filtered out on return $images[] = get_post_featured_image_url($post_id, 'full'); if ($attachments) { foreach ($attachments as $attachment) { $image = wp_get_attachment_image_src($attachment->ID, 'full'); $images[] = $image[0]; } } return array_unique($images); }
<article class="<?php echo $klass; ?> "> <?php if ($article) { $image_size = 'medium'; if (isset($type) && $type == 'category') { $img = z_taxonomy_image_url($article->term_id); $title = $article->cat_name; $link = get_category_link($article->term_id); $price = array(); $dimension = ''; } else { $img = get_post_featured_image_url($article->ID, $image_size); $title = $article->post_title; $link = get_permalink($article->ID); $price = get_price($article->ID); $main_category = get_post_main_category_slug($article); $dimension = get_product_dimension($article, $main_category); } // $img = 'http://placehold.it/350x250'; ?> <header> <h3><a href="<?php echo $link; ?> " title="<?php echo $title;
<!-- Indicators --> <ol class="carousel-indicators"> <?php echo show_main_banner('dots'); ?> </ol> <!-- Wrapper for slides --> <div class="carousel-inner"> <?php echo show_main_banner('slides'); ?> </div> </div> <?php } else { if (get_post_featured_image_url()) { $image_url = get_post_featured_image_url(); } else { $image_url = 'http://placehold.it/1200x278'; } ?> <img src="<?php echo $image_url; ?> " class="img-responsive" style="margin:0 auto"/> <?php } ?> </div>