Esempio n. 1
0
    /**
     * Portfolio slider.
     *
     */
    public function portfolio_slider($attributes = array())
    {
        $config = Presscore_Config::get_instance();
        $slider_class = array();
        if ('disabled' == $config->get('sidebar_position')) {
            $slider_class[] = 'full';
        }
        $slider_fields = array();
        if ($attributes['show_title']) {
            $slider_fields[] = 'title';
        }
        if ($attributes['meta_info']) {
            $slider_fields[] = 'meta';
        }
        if ($attributes['show_excerpt']) {
            $slider_fields[] = 'description';
        }
        if ($attributes['show_link']) {
            $slider_fields[] = 'link';
        }
        if ($attributes['show_zoom']) {
            $slider_fields[] = 'zoom';
        }
        if ($attributes['show_details']) {
            $slider_fields[] = 'details';
        }
        $slider_style = array();
        if ($attributes['margin_bottom']) {
            $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom'];
        }
        if ($attributes['margin_top']) {
            $slider_style[] = 'margin-top: ' . $attributes['margin_top'];
        }
        $slider_args = array('mode' => $attributes['appearance'], 'fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'under_image_buttons' => $attributes['under_image_buttons'], 'hover_animation' => $attributes['hover_animation'], 'hover_bg_color' => $attributes['hover_bg_color'], 'hover_content_visibility' => $attributes['hover_content_visibility']);
        if ($attributes['height']) {
            $slider_args['height'] = $attributes['height'];
        }
        if ($attributes['width']) {
            $slider_args['img_width'] = $attributes['width'];
        }
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_portfolio_category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-portfolio_scroller" style="height: ' . $slider_args['height'] . 'px;">
					<h5>Portfolio scroller</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        } else {
            $related_posts_args = array('exclude_current' => false, 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'field' => 'slug', 'args' => array('posts_per_page' => $attributes['number'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order']));
            $related_posts_args['cats'] = $attributes['category'];
            if (!empty($attributes['category'])) {
                $related_posts_args['select'] = 'only';
            } else {
                $related_posts_args['select'] = 'all';
            }
            $attachments_data = presscore_get_related_posts($related_posts_args);
            $output = presscore_get_fullwidth_slider_two_with_hovers($attachments_data, $slider_args);
        }
        return $output;
    }
Esempio n. 2
0
 /**
  * Portfolio slider.
  *
  */
 public function portfolio_slider($attributes = array())
 {
     $config = Presscore_Config::get_instance();
     $related_posts_args = array('exclude_current' => false, 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'field' => 'slug', 'args' => array('posts_per_page' => $attributes['number'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order']));
     if (!empty($attributes['category'])) {
         $related_posts_args['cats'] = $attributes['category'];
         $related_posts_args['select'] = 'only';
     } else {
         $related_posts_args['select'] = 'all';
     }
     $attachments_data = presscore_get_related_posts($related_posts_args);
     $slider_class = array();
     if ('disabled' == $config->get('sidebar_position')) {
         $slider_class[] = 'full';
     }
     $slider_fields = array();
     if ($attributes['show_title']) {
         $slider_fields[] = 'title';
     }
     if ($attributes['meta_info']) {
         $slider_fields[] = 'meta';
     }
     if ($attributes['show_excerpt']) {
         $slider_fields[] = 'description';
     }
     if ($attributes['show_link']) {
         $slider_fields[] = 'link';
     }
     if ($attributes['show_zoom']) {
         $slider_fields[] = 'zoom';
     }
     if ($attributes['show_details']) {
         $slider_fields[] = 'details';
     }
     $slider_style = array();
     if ($attributes['margin_bottom']) {
         $slider_style[] = 'margin-bottom: ' . $attributes['margin_bottom'];
     }
     if ($attributes['margin_top']) {
         $slider_style[] = 'margin-top: ' . $attributes['margin_top'];
     }
     $slider_args = array('mode' => $attributes['appearance'], 'fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'under_image_buttons' => $attributes['under_image_buttons'], 'hover_animation' => $attributes['hover_animation'], 'hover_bg_color' => $attributes['hover_bg_color'], 'hover_content_visibility' => $attributes['hover_content_visibility']);
     if ($attributes['height']) {
         $slider_args['height'] = $attributes['height'];
     }
     if ($attributes['width']) {
         $slider_args['img_width'] = $attributes['width'];
     }
     $output = presscore_get_fullwidth_slider_two_with_hovers($attachments_data, $slider_args);
     return $output;
 }