/** * Handles VC image shortcode * * @return shortcode HTML **/ function oxy_complex_image($atts, $content = '') { // setup options extract(shortcode_atts(array('image' => '', 'size' => 'medium', 'title' => '', 'image_stretch' => 'normalwidth', 'alt' => '', 'item_link_type' => 'magnific', 'link' => '', 'link_target' => '_self', 'magnific_type' => 'image', 'magnific_link' => '', 'magnific_popup_caption' => '', 'captions_below' => 'hide', 'captions_below_link_type' => 'item', 'caption_title' => '', 'caption_text' => '', 'caption_align' => 'center', 'hover_filter' => 'none', 'hover_filter_invert' => 'image-filter-onhover', 'overlay' => 'icon', 'button_text_zoom' => 'View Larger', 'button_text_details' => 'More Details', 'overlay_caption_vertical' => 'middle', 'overlay_animation' => 'fade-in', 'overlay_grid' => '0', 'overlay_icon' => 'plus', 'extra_classes' => '', 'margin_top' => '20', 'margin_bottom' => '20', 'scroll_animation' => 'none', 'portfolio_item' => false, 'scroll_animation_delay' => '0', 'hidden_on_large' => 'off', 'hidden_on_medium' => 'off', 'hidden_on_small' => 'off', 'hidden_on_xsmall' => 'off'), $atts)); $src = ''; $attachment = wp_get_attachment_image_src($image, $size); if (isset($attachment[0])) { $src = $attachment[0]; } $figure_classes = array(); $figure_classes[] = oxy_add_extra_shortcode_classes($atts); $figure_classes[] = 'element-top-' . $margin_top; $figure_classes[] = 'element-bottom-' . $margin_bottom; if ($scroll_animation !== 'none') { $figure_classes[] = $portfolio_item ? 'portfolio-os-animation' : 'os-animation'; } if ($overlay === 'strip') { $figure_classes[] = 'preview-bottom'; } $figure_classes[] = 'image-filter-' . $hover_filter; $figure_classes[] = $hover_filter_invert; $figure_classes[] = $overlay_animation; $figure_classes[] = 'text-' . $caption_align; $figure_classes[] = 'figcaption-' . $overlay_caption_vertical; $overlay_classes = array('grid-overlay-' . $overlay_grid); // create magnific link $magnific_link_classes = array(); $gallery_images = array(); $captions = array(); $magnific_link_url = ''; $text_captions = ''; switch ($magnific_type) { case 'image': $full = wp_get_attachment_image_src($image, 'full'); $magnific_link_url = $full[0]; //gathering the image captions $text_captions = $magnific_popup_caption === '' ? '' : 'data-captions="' . esc_attr($magnific_popup_caption) . '"'; $magnific_link_classes[] = 'magnific'; break; case 'video': $magnific_link_url = $magnific_link; $magnific_link_classes[] = 'magnific-vimeo'; break; case 'gallery': if (!empty($magnific_link) && is_array($magnific_link)) { // ok lets create a gallery foreach ($magnific_link as $gallery_image_id) { $gallery_image = wp_get_attachment_image_src($gallery_image_id, 'full'); $gallery_images[] = $gallery_image[0]; if ($magnific_popup_caption !== 'hide') { //gathering the image captions $captions[] = oxy_get_image_caption($gallery_image_id); } } $text_captions = empty($captions) ? '' : 'data-captions="' . esc_attr(implode(',', $captions)) . '"'; $full = wp_get_attachment_image_src($image, 'full'); $magnific_link_url = $full[0]; $magnific_link_classes[] = 'magnific-gallery'; } break; } // set up links $hover_link_classes = array(); $hover_link = ''; // never set hover link if we are using buttons a inside a breaks the markup if ($overlay !== 'buttons' && $overlay !== 'buttons_only') { switch ($item_link_type) { case 'magnific': case 'magnific-all': $hover_link = $magnific_link_url; $hover_link_classes = $magnific_link_classes; break; case 'item': $hover_link = $link; break; case 'no-link': // hover_link is default '' break; } } $below_title_link_classes = array(); $below_title_link = ''; switch ($captions_below_link_type) { case 'magnific': $below_title_link = $magnific_link_url; $below_title_link_classes = $magnific_link_classes; break; case 'item': $below_title_link = $link; break; case 'no-link': // hover_link is default '' break; } ob_start(); include locate_template('partials/shortcodes/complex-image.php'); $output = ob_get_contents(); ob_end_clean(); return $output; }
$magnific_link = $video; break; case 'gallery': $magnific_type = 'gallery'; $gallery_content = get_post_meta($post->ID, THEME_SHORT . '_post_gallery', true); $magnific_link = oxy_get_content_gallery($gallery_content); if ($magnific_caption === 'off') { $magnific_popup_caption = 'hide'; } break; default: case 'standard': break; } if ($magnific_caption === 'image_caption') { $magnific_popup_caption = oxy_get_image_caption(get_post_thumbnail_id($post->ID)); } else { if ($magnific_caption === 'post_title_caption') { $magnific_popup_caption = get_the_title($post->ID); } } $title = $magnific_popup_caption; if ($magnific_caption === 'off') { $title = ''; } ?> <div class="masonry-item portfolio-item <?php echo implode(' ', $post->classes); ?> " data-menu-order="<?php