/**
 * Standard Gallery Shortcode
 */
function om_custom_gallery_shortcode($atts)
{
    if ((!isset($atts['layout']) || $atts['layout'] == 'default') && get_option(OM_THEME_PREFIX . 'do_replace_gallery') == 'true') {
        $atts['layout'] = 'sliced';
    }
    if (!isset($atts['layout']) || $atts['layout'] == 'default') {
        $atts['layout'] = 'grid';
    }
    if (!isset($atts['captions'])) {
        $atts['captions'] = 'yes';
    }
    if (!isset($atts['link'])) {
        $atts['link'] = 'post';
    }
    $args = array('mode' => $atts['layout'], 'show_captions' => $atts['captions'] != 'no', 'link_to' => $atts['link']);
    if (isset($atts['columns'])) {
        $args['columns'] = $atts['columns'];
    }
    if (isset($atts['ratio'])) {
        $args['ratio'] = $atts['ratio'];
    }
    $attachments = false;
    if (isset($atts['ids']) && $atts['ids']) {
        $attachments = explode(',', $atts['ids']);
    }
    if (empty($attachments)) {
        global $post;
        if (isset($post) && is_object($post)) {
            $attachments = $post->ID;
        }
    } else {
        $attachments = get_posts(array('post_type' => 'attachment', 'orderby' => isset($atts['orderby']) && $atts['orderby'] == 'rand' ? 'rand' : 'post__in', 'post__in' => $attachments, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1));
    }
    return '<div class="om-inline-gallery-wrapper">' . om_get_custom_gallery($attachments, $args) . '</div>';
}
Beispiel #2
0
 function om_custom_gallery($attachments, $args = array())
 {
     echo om_get_custom_gallery($attachments, $args);
 }
<?php

get_template_part('includes/post-single-header');
?>

	<?php 
$gallery = om_get_custom_gallery(get_the_ID(), array('image_size' => 'post-media-large', 'show_captions' => get_post_meta(get_the_ID(), OM_THEME_SHORT_PREFIX . 'gallery_captions', true) == 'true', 'mode' => get_post_meta(get_the_ID(), OM_THEME_SHORT_PREFIX . 'gallery_mode', true)));
if ($gallery) {
    ?>
		<div class="post-media">
			<?php 
    echo om_esc_sg($gallery);
    ?>
		</div>
	<?php 
}
?>

<?php 
get_template_part('includes/post-single-footer');
Beispiel #4
0
    $links = false;
    if ($onclick == 'link_no') {
        $link_to = 'none';
    } elseif ($onclick == 'custom_link') {
        $link_to = 'custom_link';
        $links = explode(',', $custom_links);
    }
    $args = array('mode' => $mode, 'show_captions' => $captions == 'yes', 'link_to' => $link_to, 'links' => $links, 'url_link_target' => $custom_links_target, 'columns' => $columns, 'ratio' => $ratio);
    if ($hires == 'yes' && in_array($type, array('sliced', 'masonry', 'image_grid'))) {
        $args['hires'] = true;
    }
    if ($images) {
        $images = explode(',', $images);
        $attachments = get_posts(array('post_type' => 'attachment', 'orderby' => 'post__in', 'post__in' => $images, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1));
        $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_gallery wpb_content_element' . $el_class . ' vc_clearfix', $this->settings['base'], $atts);
        $output = '<div class="' . $css_class . '">' . wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_gallery_heading')) . om_get_custom_gallery($attachments, $args) . '</div>';
    }
} else {
    $el_class = $this->getExtraClass($el_class);
    if ($type == 'nivo') {
        $type = ' wpb_slider_nivo theme-default';
        wp_enqueue_script('nivo-slider');
        wp_enqueue_style('nivo-slider-css');
        wp_enqueue_style('nivo-slider-theme');
        $slides_wrap_start = '<div class="nivoSlider">';
        $slides_wrap_end = '</div>';
    } else {
        if ($type == 'flexslider' || $type == 'flexslider_fade' || $type == 'flexslider_slide' || $type == 'fading') {
            $el_start = '<li>';
            $el_end = '</li>';
            $slides_wrap_start = '<ul class="slides">';