<?php while (have_posts()) { the_post(); echo '<a class="filter" href="javascript:;" data-rel="filter-gallery-' . get_the_ID() . '">' . get_the_title(get_the_ID()) . '</a>'; } ?> </div> </div> <?php } ?> <div class="wrapper-gallery-filter row" itemscope itemtype="http://schema.org/ItemList"> <?php while (have_posts()) { the_post(); $images = thim_meta('thim_gallery', "type=image&single=false&size=full"); if (empty($images)) { break; } foreach ($images as $image) { $data = @getimagesize($image['url']); $width_data = $data[0]; $height_data = $data[1]; if (!($width_data > 534) && !($height_data > 355)) { echo '<a class="col-sm-4 fancybox" data-fancybox-group="gallery" data-filter="filter-gallery-' . get_the_ID() . '" href="' . $image['url'] . '"><img src="' . $image['url'] . '" alt= "' . get_the_title() . '" title = "' . get_the_title() . '" /></a>'; } else { $crop = $height_data < 534 ? false : true; $image_crop = aq_resize($image['url'], 355, 534, $crop); echo '<a class="col-sm-4 fancybox" data-fancybox-group="gallery" data-filter="filter-gallery-' . get_the_ID() . '" href="' . $image['url'] . '"><img src="' . $image_crop . '" alt= "' . get_the_title() . '" title = "' . get_the_title() . '" /></a>'; } }
/** * Get post thumbnail src based on post formats * @return void */ function thim_post_thumbnail_src($size) { $src = ''; switch (get_post_format()) { case 'gallery': $images = thim_meta('images', "type=image&single=false&size={$size}"); if (empty($images)) { break; } $image = current($images); $src = $image['url']; break; default: $src = thim_get_image(array('size' => $size, 'format' => 'src', 'meta_key' => 'image', 'echo' => false)); break; } return $src; }