<div class="wpex-slider-slides sp-slides <?php if ($lightbox_enabled) { echo 'lightbox-group'; } ?> "> <?php // Loop through attachments foreach ($attachments as $attachment) { ?> <?php // Get attachment data $lightbox_url = $lightbox_enabled ? wpex_get_lightbox_image($attachment) : ''; $attachment_data = wpex_get_attachment_data($attachment); $attachment_alt = $attachment_data['alt']; $attachment_video = $attachment_data['video']; $attachment_caption = $attachment_data['caption']; // Get image output $attachment_html = wpex_get_blog_entry_thumbnail(array('attachment' => $attachment, 'alt' => $attachment_alt)); ?> <div class="wpex-slider-slide sp-slide"> <?php // Display attachment video if ($attachment_video && !is_wp_error($attachment_video = wp_oembed_get($attachment_video))) { ?> <div class="wpex-slider-video responsive-video-wrap">
" data-items-mobile-portrait="<?php echo $mobile_portrait_items; ?> "> <?php // Loop through images while ($my_query->have_posts()) { // Get post from query $my_query->the_post(); // Create new post object. $post = new stdClass(); // Get attachment ID $post->id = get_the_ID(); // Attachment VARS $post->data = wpex_get_attachment_data($post->id); $post->link = $post->data['url']; $post->alt = esc_attr($post->data['alt']); $post->caption = $post->data['caption']; // Pluck array to see if item has custom link $post->url = $images_links_array[$post->id]; // Validate URl $post->url = '#' !== $post->url ? esc_url($post->url) : ''; // Get correct title if ('title' == $title_type) { $attachment_title = get_the_title(); } elseif ('alt' == $title_type) { $attachment_title = esc_attr($post->data['alt']); } else { $attachment_title = get_the_title(); }
} // TOTAL OVERLAY CAPTION END $wrapper_classes = 'vc_single_image-wrapper'; if ($style) { $wrapper_classes .= ' ' . $style; $wrapper_classes .= ' ' . $border_color; } if ($img_filter) { $wrapper_classes .= ' ' . $img_filter; } if ($img_hover) { $wrapper_classes .= ' ' . $img_hover; } $html = '<div class="' . $wrapper_classes . '">' . $html . '</div>'; // Get title attribute from image $img_title = wpex_get_attachment_data($img_id, 'alt'); if ($img_title) { $a_attrs['title'] = $img_title; } if ($link) { $a_attrs['href'] = $link; if ('local' != $img_link_target) { $a_attrs['target'] = $img_link_target; } else { $a_attrs['class'] = 'local-scroll-link'; } $html = '<a ' . vc_stringify_attributes($a_attrs) . '>' . $html . '</a>'; } $class_to_filter = 'wpb_single_image wpb_content_element vc_align_' . $alignment . ' ' . $this->getCSSAnimation($css_animation); $class_to_filter .= vc_shortcode_custom_css_class($css, ' ') . $this->getExtraClass($el_class); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts);
/** * Tweaks the default WP Gallery Output * * @since 1.0.0 */ public static function output($output, $attr) { // Main Variables global $post, $wp_locale, $instance; $instance++; static $instance = 0; $output = ''; // Sanitize orderby statement if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } // Get shortcode attributes extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'columns' => 3, 'include' => '', 'exclude' => '', 'img_height' => '', 'img_width' => '', 'size' => '', 'crop' => ''), $attr)); // Get post ID $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => '', 'inherit' => '', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; $size = $size ? $size : 'thumbnail'; foreach ($attachments as $attachment_id => $attachment) { $output .= wp_get_attachment_link($attachment_id, $size, true) . "\n"; } return $output; } // Get columns # $columns = intval($columns); // Set cropping sizes if ($columns > 1) { $img_width = $img_width ? $img_width : wpex_get_mod('gallery_image_width'); $img_height = $img_height ? $img_height : wpex_get_mod('gallery_image_height'); } // Sanitize Data $size = $size ? $size : 'large'; $size = $img_width || $img_height ? 'wpex_custom' : $size; $crop = $crop ? $crop : 'center-center'; // Float $float = is_rtl() ? 'right' : 'left'; // Load lightbox skin stylesheet wpex_enqueue_ilightbox_skin(); // Begin output $output .= '<div id="gallery-' . $instance . '" class="wpex-gallery wpex-row lightbox-group clr">'; // Begin Loop $count = 0; foreach ($attachments as $attachment_id => $attachment) { // Increase counter for clearing floats $count++; // Attachment Vars $attachment_data = wpex_get_attachment_data($attachment_id); $alt = $attachment_data['alt']; $caption = $attachment_data['caption']; $video = $attachment_data['video']; $lightbox_url = $video ? $video : wpex_get_lightbox_image($attachment_id); // Generate the image HTMl $img_html = wpex_get_post_thumbnail(array('attachment' => $attachment_id, 'size' => $size, 'width' => $img_width, 'height' => $img_height, 'crop' => $crop)); // Add data attributes for lightbox if ($video) { $lightbox_data = ' data-options="thumbnail: \'' . wpex_get_lightbox_image($attachment_id) . '\', width:1920, height:1080"'; } else { $lightbox_data = ' data-type="image"'; } // Start Gallery Item $output .= '<figure class="gallery-item ' . wpex_grid_class($columns) . ' col col-' . $count . '">'; // Display image $output .= '<a href="' . $lightbox_url . '" title="' . wp_strip_all_tags($caption) . '" class="wpex-lightbox-group-item"' . $lightbox_data . '>'; $output .= $img_html; $output .= '</a>'; // Display Caption if (trim($attachment->post_excerpt)) { if (wpex_is_front_end_composer()) { $output .= '<div class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</div>'; } else { $output .= '<figcaption class="gallery-caption">' . wptexturize($attachment->post_excerpt) . '</figcaption>'; } } // Close gallery item div $output .= "</figure>"; // Set vars to remove margin on last item of each row and clear floats if ($count == $columns) { $count = '0'; } } // Close gallery div $output .= "</div>\n"; return $output; }