function gdlr_gallery_shortcode($atts) { if (!empty($atts['masterslider']) && $atts['masterslider'] == "true") { return gallery_shortcode($atts); } extract(shortcode_atts(array('columns' => '3', 'ids' => '', 'link' => 'post', 'type' => 'grid', 'caption' => 'yes', 'caption_position' => 'left', 'thumbnail_size' => 'thumbnail', 'size' => ''), $atts)); $settings = array(); $settings['show-caption'] = $caption; if (!empty($size)) { $settings['thumbnail-size'] = $size; } else { $settings['thumbnail-size'] = $thumbnail_size; } $settings['gallery-columns'] = $columns; $slides = array(); $ids = explode(',', $ids); foreach ($ids as $slide_id) { $data = array(); if ($link == 'file') { $data['slide-link'] = 'current'; } else { if ($link == 'post') { $data['new-tab'] = 'disable'; $data['slide-link'] = 'url'; $data['url'] = get_permalink($slide_id); } } if ($type == 'slider' && $caption == 'yes') { $attachment = gdlr_get_attachment_info($slide_id); $data['title'] = $attachment['title']; $data['caption'] = $attachment['caption']; $data['caption-position'] = $caption_position; } $slides[$slide_id] = $data; } if (function_exists('gdlr_get_slider_item') && $type == 'slider') { $settings['slider-type'] = 'flexslider'; return gdlr_get_flex_slider($slides, array('size' => $thumbnail_size)); } else { if (function_exists('gdlr_get_gallery_thumbnail') && $type == 'thumbnail') { $settings['slider'] = $slides; return '<div class="gdlr-shortcode-wrapper">' . gdlr_get_gallery_thumbnail($settings) . '</div>'; } else { if (function_exists('gdlr_get_gallery')) { $settings['slider'] = $slides; return '<div class="gdlr-shortcode-wrapper">' . gdlr_get_gallery($settings) . '</div>'; } } } return ''; }
function gdlr_get_banner_item($settings) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $gdlr_spaces; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; $slider_option = json_decode($settings['slider'], true); $slide_order = $slider_option[0]; $slide_data = $slider_option[1]; $slides = array(); foreach ($slide_order as $slide) { $slides[$slide] = $slide_data[$slide]; } $ret = '<div class="gdlr-banner-item-wrapper">'; $ret .= '<div class="gdlr-banner-images gdlr-item" ' . $margin_style . '>'; $ret .= gdlr_get_flex_slider($slides, array('size' => $settings['thumbnail-size'], 'columns' => $settings['banner-columns'], 'carousel' => true, 'nav-container' => 'gdlr-banner-images')); $ret .= '</div>'; // gdlr-banner-images $ret .= '</div>'; // gdlr-banner-item-wrapper return $ret; }
<?php /** * The template for displaying video post format */ global $gdlr_post_settings; $post_format_data = ''; $content = trim(get_the_content(__('Read More', 'gdlr_translate'))); if (preg_match('#^\\[gallery[^\\]]+]#', $content, $match)) { if (is_single()) { $post_format_data = do_shortcode($match[0]); } else { preg_match('#^\\[gallery.+ids\\s?=\\s?\\"([^\\"]+).+]#', $match[0], $match2); $post_format_data = gdlr_get_flex_slider(explode(',', $match2[1]), array('size' => $gdlr_post_settings['thumbnail-size'])); } $gdlr_post_settings['content'] = substr($content, strlen($match[0])); } else { $gdlr_post_settings['content'] = $content; } if (!empty($post_format_data)) { echo '<div class="gdlr-blog-thumbnail gdlr-gallery">' . $post_format_data . '</div>'; } ?>