function related_posts_shortcode($atts) { extract(shortcode_atts(array('limit' => '4', 'width' => 400, 'height' => 300, 'taxonomy' => GALLERY_TAXONOMY), $atts)); global $post, $imgDimensions; $imgDimensions = array('width' => $width, 'height' => $height); if ($post->ID) { // Get tags $filter = 'post_tag'; $tags = wp_get_post_terms($post->ID, 'post_tag', array("fields" => "ids")); $list = ""; $tag_arr = ""; if ($tags) { $args = array('tag__in' => $tags, 'post__not_in' => array($post->ID), 'post_type' => get_post_type(), 'showposts' => $limit, 'ignore_sticky_posts' => 1); $related_posts = new WP_Query($args); if ($related_posts) { $list = '<div id="related-posts" class="entry-related-images portfolio-four-columns"><h3 class="related-title">' . __('Related Posts', MAX_SHORTNAME) . '</h3><ul class="clearfix portfolio-list">'; if ($related_posts->have_posts()) { while ($related_posts->have_posts()) { $related_posts->the_post(); if (has_post_thumbnail(get_the_ID())) { $hover_class = ""; if (get_option_max('image_show_fade') != "true") { $hover_class = ' no-hover'; } $list .= '<li class="item ' . max_get_post_lightbox_class() . $hover_class . '"><div class="shadow">'; // get the imgUrl for showing the post image $_imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(get_the_ID()), get_the_ID(), esc_attr($width), esc_attr($height), get_cropping_direction(get_post_meta(get_the_ID(), MAX_SHORTNAME . '_photo_cropping_direction_value', true))); // get the gallery item $list .= '<a href="' . get_permalink(get_the_ID()) . '" title="' . get_the_title() . '"><img src="' . $_imgUrl . '" alt="' . get_the_title() . '" /></a></div>'; // check if caption option is selected if (get_option_max('image_show_caption') == 'true') { $list .= '<div class="item-caption"><strong>' . wptexturize(get_the_title()) . '</strong></div>'; } $list .= '</li>'; } else { continue; } } } wp_reset_query(); $list .= '</ul></div>'; } } return $list; } return; }
?> <?php $_term_classes = ""; // check if the template is a quicksand sortable template if ($p_tpl == "template-sortable.php") { // get the term slug and display it as class list foreach (@get_the_terms(get_the_ID(), GALLERY_TAXONOMY) as $term) { $_term_classes .= urldecode($term->slug . " "); } } ?> <?php // get the lightbox class $lightbox_class = max_get_post_lightbox_class(); if (get_option_max('image_always_lightbox') == 'true') { $video_class = ""; if ($lightbox_class === 'video') { $video_class = " video"; } $lightbox_class = $video_class . ' detail-link'; } ?> <li data-time="<?php the_time('Ymdhi'); ?> " data-modified="<?php the_modified_time('Ymdhi'); ?>
</div> <ul id="portfolioList" class="clearfix portfolio-list"> <?php // start the posts loop while ($gallery_posts->have_posts()) { $gallery_posts->the_post(); // get the default image if we don't have to crop $_imgUrl = max_get_custom_image_url(get_post_thumbnail_id(get_the_ID()), null, 400, 300, get_cropping_direction(get_post_meta(get_the_ID(), MAX_SHORTNAME . '_photo_cropping_direction_value', true))); ?> <li data-id="id-<?php echo get_the_ID(); ?> " class="item <?php echo max_get_post_lightbox_class(); if (get_option_max('image_show_fade') != "true") { echo " no-hover"; } ?> "> <div class="shadow"> <?php echo '<a href="' . get_permalink() . '" title="' . strip_tags(get_the_title()) . '"><img src="' . $_imgUrl . '" alt="' . strip_tags(get_the_title()) . '" /></a>'; ?> </div> <?php // check if caption option is selected if (get_option_max('image_show_caption') == 'true') { ?> <div class="item-caption">