} else { $gallery_images .= wp_get_attachment_url($id); } } $a_attrs['data-gallery'] = $gallery_images; } // Link to nothing $link = '#'; } // CUSTOM LIGHTBOX GALLERY END - TOTAL SETTINGS switch ($onclick) { case 'img_link_large': if ('external_link' === $source) { $link = $custom_src; } elseif (function_exists('wpex_get_lightbox_image')) { $link = wpex_get_lightbox_image($img_id); } else { $link = wp_get_attachment_image_src($img_id, 'large'); $link = $link[0]; } // Add class for Total theme vcex_inline_js('ilightbox_single'); wpex_enqueue_ilightbox_skin(); $a_attrs['class'] = 'wpex-lightbox'; break; case 'link_image': wp_enqueue_script('prettyphoto'); wp_enqueue_style('prettyphoto'); $a_attrs['class'] = 'prettyphoto'; $a_attrs['rel'] = 'prettyPhoto[rel-' . get_the_ID() . '-' . rand() . ']'; // backward compatibility
<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))) { ?>
<a href="<?php echo $atts['lightbox_link']; ?> " title="<?php wpex_esc_title(); ?> " class="wpex-lightbox" data-type="iframe" data-options="<?php echo $data_options; ?> "> <?php // Image lightbox link } else { // Add lightbox attributes $atts['lightbox_link'] = wpex_get_lightbox_image(); ?> <a href="<?php echo $atts['lightbox_link']; ?> " title="<?php wpex_esc_title(); ?> " class="wpex-lightbox"> <?php } ?> <?php
<div class="wpex-carousel-slide"> <div class="<?php echo $img_classes; ?> "> <?php // Add custom links to attributes for use with the overlay styles if ('custom_link' == $thumbnail_link && $post->url) { $atts['overlay_link'] = $post->url; } // Lightbox if ('lightbox' == $thumbnail_link) { // Get lightbox image link $atts['lightbox_link'] = wpex_get_lightbox_image($post->id); ?> <a href="<?php echo $atts['lightbox_link']; ?> " title="<?php echo esc_attr($post->alt); ?> " class="wpex-carousel-entry-img wpex-lightbox"<?php echo implode(' ', $atts['lightbox_data']); ?> > <?php echo $image_output; ?>
/** * Echo lightbox image URL * * @since 2.0.0 */ function wpex_lightbox_image($attachment = '') { echo wpex_get_lightbox_image($attachment); }
/** * 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; }
?> <?php // Get attachment alt $attachment_alt = get_post_meta($attachment, '_wp_attachment_image_alt', true); // Get thumbnail $args = apply_filters('wpex_woo_variation_thumb_args', array('attachment' => $attachment, 'size' => 'shop_single')); $thumbnail = wpex_get_post_thumbnail($args); ?> <?php if ($thumbnail) { ?> <a href="<?php echo wpex_get_lightbox_image($attachment); ?> " title="<?php echo $attachment_alt; ?> " data-title="<?php echo $attachment_alt; ?> " data-type="image" class="wpex-lightbox-group-item"> <?php echo $thumbnail; ?> </a> <?php }
* @package Total WordPress Theme * @subpackage Partials * @version 3.0.0 */ // Exit if accessed directly if (!defined('ABSPATH')) { exit; } // Only used for outside position if ('outside_link' != $position) { return; } // Load lightbox skin stylesheet wpex_enqueue_ilightbox_skin(); // Lightbox $lightbox_link = !empty($args['lightbox_link']) ? $args['lightbox_link'] : wpex_get_lightbox_image(); $lightbox_data = !empty($args['lightbox_data']) ? implode(' ', $args['lightbox_data']) : ''; // Link $link = isset($args['overlay_link']) ? $args['overlay_link'] : wpex_get_permalink(); $link = apply_filters('wpex_lightbox_buttons_text_overlay_link', $link); // Define link target $target = ''; if (isset($args['link_target'])) { if ('blank' == $args['link_target'] || '_blank' == $args['link_target']) { $target = 'blank'; } } $target = apply_filters('wpex_button_overlay_target', $target); $target = 'blank' == $target ? ' target="_blank"' : ''; ?>
$entry_classes[] = 'col-' . $count; $entry_classes[] = 'post-type-' . get_post_type($post->ID); if (taxonomy_exists($filter_taxonomy)) { if ($post_terms = get_the_terms($post, $filter_taxonomy)) { foreach ($post_terms as $post_term) { $entry_classes[] = 'cat-' . $post_term->term_id; } } } $entry_classes = array_merge($static_entry_classes, $entry_classes); // Define entry link and entry link classes $entry_link = $post->permalink; if ($thumb_link == 'lightbox') { //$entry_link = $post->video ? $post->video : $post->thumbnail; //$entry_link_classes = $post->video ? 'wpex-lightbox-video' : 'wpex-lightbox'; $entry_link = wpex_get_lightbox_image(); $entry_link_classes = 'wpex-lightbox'; $atts['lightbox_link'] = $entry_link; } $entry_link_classes = !empty($entry_link_classes) ? 'class="' . $entry_link_classes . '"' : ''; // Entry image output HTMl if ($post->thumbnail) { $entry_image = wpex_get_post_thumbnail(array('size' => $img_size, 'crop' => $img_crop, 'width' => $img_width, 'height' => $img_height, 'alt' => wpex_get_esc_title())); } ?> <div <?php post_class($entry_classes); ?> >
// Get post from query $wpex_query->the_post(); // Create new post object. $post = new stdClass(); // Get post data $get_post = get_post(); // Post VARS $post->ID = $get_post->ID; $post->permalink = wpex_get_permalink($post->ID); $post->title = get_the_title(); $post->title_attribute = esc_attr(the_title_attribute('echo=0')); $post->thumbnail = get_post_thumbnail_id($post->ID); $post->thumbnail_link = $post->permalink; // Lightbox thumbnail if ('lightbox' == $thumbnail_link) { $atts['lightbox_link'] = wpex_get_lightbox_image($post->thumbnail); $post->thumbnail_link = $atts['lightbox_link']; } // Only display carousel item if there is content to show if ('true' == $media && has_post_thumbnail() || 'true' == $title || 'true' == $date || 'true' == $excerpt) { ?> <div class="wpex-carousel-slide"> <?php // Display thumbnail if enabled and defined if ('true' == $media && has_post_thumbnail()) { ?> <div class="<?php echo $media_classes;
if (!empty($hover_classes)) { ?> <div class="<?php echo $hover_classes; ?> "> <?php } ?> <?php // Lightbox if ('lightbox' == $thumbnail_link) { // Define lightbox vars $atts['lightbox_data'] = array(); $lightbox_image = wpex_get_lightbox_image($post->id); $lightbox_url = $lightbox_image; $video_url = $post->data['video']; // Data attributes if ('false' != $lightbox_title) { if ('title' == $lightbox_title) { $atts['lightbox_data'][] = ' data-title="' . strip_tags(get_the_title($post->id)) . '"'; } else { $atts['lightbox_data'][] = ' data-title="' . $post->alt . '"'; } } // Caption data if ('false' != $lightbox_caption) { if ($attachment_caption = get_post_field('post_excerpt', $post->id)) { $atts['lightbox_data'][] = ' data-caption="' . str_replace('"', "'", $attachment_caption) . '"'; }
echo $media_classes; ?> "> <?php // Open link tag if thumblink does not equal nowhere if ('nowhere' != $thumb_link) { ?> <?php // Lightbox if ('lightbox' == $thumb_link) { // Save correct lightbox class $lightbox_class = $lightbox_single_class; // Generate lightbox image $lightbox_image = wpex_get_lightbox_image(); // Get lightbox link $atts['lightbox_link'] = $lightbox_image; // Define lightbox data attributes $atts['lightbox_data'] = array(); if ($lightbox_skin) { $atts['lightbox_data'][] = 'data-skin="' . $lightbox_skin . '"'; } if ('true' == $thumb_lightbox_title) { $atts['lightbox_data'][] = 'data-title="' . wpex_get_esc_title() . '"'; } if ('true' == $thumb_lightbox_caption && $post->excerpt) { $atts['lightbox_data'][] = 'data-caption="' . str_replace('"', "'", $post->excerpt) . '"'; } // Check for video if ($post->video = get_post_meta($post->ID, 'wpex_post_video', true)) {
// Overlay style $overlay = wpex_get_mod('blog_entry_overlay'); ?> <div class="blog-entry-media entry-media clr <?php echo wpex_overlay_classes($overlay); ?> "> <?php // Lightbox style entry if (wpex_get_mod('blog_entry_image_lightbox')) { // Load lightbox skin stylesheet wpex_enqueue_ilightbox_skin(); // Get lightbox image $lightbox_image = wpex_get_lightbox_image(get_post_thumbnail_id()); ?> <a href="<?php echo $lightbox_image; ?> " title="<?php echo esc_attr(the_title_attribute('echo=0')); ?> " rel="bookmark" class="blog-entry-media-link wpex-lightbox<?php wpex_entry_image_animation_classes(); ?> " data-type="image"> <?php echo $thumbnail; ?>