public function shortcode($atts, $content = null)
 {
     $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', 'the7mk2');
         return $this->vc_inline_dummy(array('class' => 'dt_vc-benefits', 'title' => _x('Benefits', 'vc inline dummy', 'the7mk2'), 'fields' => array($terms_title => presscore_get_terms_list_by_slug(array('slugs' => $this->atts['category'], 'taxonomy' => $this->taxonomy)))));
     }
     if ('dt_benefits' == get_post_type()) {
         return '';
     }
     self::$shortcodes_count++;
     $output = '';
     $dt_query = $this->get_posts_by_terms($this->atts);
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $benefits = '';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             $benefit_attr = $this->get_benefit_data();
             $benefit_content = apply_filters('the_content', get_the_content(''));
             $benefits .= $this->render_benefit($benefit_attr, $benefit_content);
         }
         $this->restore_post_object();
         $output .= '<section id="' . $this->get_shortcode_id() . '" ' . $this->get_container_html_class('benefits-grid wf-container') . $this->get_conatiner_data_attributes() . '>';
         $output .= $this->get_inline_stylesheet();
         $output .= $benefits;
         $output .= '</section>';
     }
     return $output;
 }
 public function shortcode($atts, $content = null)
 {
     $attributes = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', LANGUAGE_ZONE);
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-photos_masonry', 'title' => _x('Photos masonry', 'vc inline dummy', LANGUAGE_ZONE), 'fields' => array($terms_title => $terms_list)));
     }
     $output = '';
     $dt_query = $this->get_albums_attachments(array('orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config($attributes);
         ob_start();
         do_action('presscore_before_shortcode_loop', $this->shortcode_name, $attributes);
         // masonry container open
         echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-gallery-container', 'dt-photos-shortcode')) . presscore_masonry_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             dt_get_template_part('media/media-masonry-post');
         }
         // masonry container close
         echo '</div>';
         do_action('presscore_after_shortcode_loop', $this->shortcode_name, $attributes);
         $output = ob_get_contents();
         ob_end_clean();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
Example #3
0
        protected function testimonials_slider($attributes = array())
        {
            if (presscore_vc_is_inline()) {
                $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
                $dummy = '
					<div class="dt_vc-shortcode_dummy dt_vc-testimonials" style="height: 250px;">
						<h5>Testimonials slider</h5>
						<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
					</div>
				';
                return $dummy;
            }
            $output = '';
            $dt_query = $this->get_posts_by_terms($attributes);
            if ($dt_query->have_posts()) {
                $autoslide = $attributes['autoslide'];
                $output .= '<ul class="testimonials slider-content rsCont"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>' . "\n";
                $this->backup_post_object();
                while ($dt_query->have_posts()) {
                    $dt_query->the_post();
                    $output .= '<li>' . Presscore_Inc_Testimonials_Post_Type::render_testimonial() . '</li>';
                }
                $this->restore_post_object();
                $output .= '</ul>' . "\n";
                $output = '<section class="testimonial-item testimonial-item-slider">' . $output . '</section>';
            }
            return $output;
        }
Example #4
0
        public function shortcode($atts, $content = null)
        {
            $attributes = $this->sanitize_attributes($atts);
            if (presscore_vc_is_inline()) {
                $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
                $dummy = '
					<div class="dt_vc-shortcode_dummy dt_vc-photos_scroller" style="height: ' . $slider_args['height'] . 'px;">
						<h5>Photos scroller</h5>
						<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
					</div>
				';
                return $dummy;
            }
            $attachments_ids = array();
            // get albums
            $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1)));
            if ($dt_query->have_posts()) {
                // take albums id
                foreach ($dt_query->posts as $dt_post) {
                    $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true);
                    if ($album_attachments) {
                        $attachments_ids = array_merge($attachments_ids, $album_attachments);
                    }
                }
            }
            if ('rand' == $attributes['orderby']) {
                shuffle($attachments_ids);
            }
            // new query to take attachments
            $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']);
            $config = Presscore_Config::get_instance();
            $slider_class = array('shortcode-instagram');
            if ('disabled' == $config->get('sidebar_position')) {
                $slider_class[] = 'full';
            }
            $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_fields = array();
            /*if ( $attributes['arrows'] ) {
            			$slider_fields[] = 'arrows';
            		}*/
            $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo');
            $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons);
            /*if ( $attributes['slider_title'] ) {
            			$slider_args['title'] = $attributes['slider_title'];
            		}*/
            if ($attributes['height']) {
                $slider_args['height'] = $attributes['height'];
            }
            if ($attributes['width']) {
                $slider_args['img_width'] = $attributes['width'];
            }
            $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args);
            return $output;
        }
    public function shortcode($atts, $content = null)
    {
        extract(shortcode_atts(array('featured_images' => 'true', 'round_images' => '', 'images_width' => 60, 'images_height' => 60, 'category' => '', 'order' => '', 'orderby' => '', 'number' => 6, 'columns' => 1), $atts));
        // sanitize attributes
        $featured_images = apply_filters('dt_sanitize_flag', $featured_images);
        $round_images = apply_filters('dt_sanitize_flag', $round_images);
        $order = apply_filters('dt_sanitize_order', $order);
        $orderby = apply_filters('dt_sanitize_orderby', $orderby);
        $number = apply_filters('dt_sanitize_posts_per_page', $number);
        $columns = absint($columns);
        $images_width = absint($images_width);
        $images_height = absint($images_height);
        if ($category) {
            $category = explode(',', $category);
            $category = array_map('trim', $category);
        }
        $related_posts_args = array('exclude_current' => false, 'post_type' => 'post', 'taxonomy' => 'category', 'field' => 'slug', 'args' => array('posts_per_page' => $number, 'orderby' => $orderby, 'order' => $order));
        if (!empty($category)) {
            $related_posts_args['cats'] = $category;
            $related_posts_args['select'] = 'only';
        } else {
            $related_posts_args['select'] = 'all';
        }
        $attachments_data = presscore_get_related_posts($related_posts_args);
        $list_args = array('show_images' => $featured_images, 'image_dimensions' => array('w' => $images_width, 'h' => $images_height));
        $posts_list = presscore_get_posts_small_list($attachments_data, $list_args);
        switch ($columns) {
            case 2:
                $column_class = 'wf-1-2';
                break;
            case 3:
                $column_class = 'wf-1-3';
                break;
            case 1:
            default:
                $column_class = 'wf-1';
        }
        $output = '';
        if ($posts_list) {
            foreach ($posts_list as $p) {
                $output .= sprintf('<div class="wf-cell %s"><div class="borders">%s</div></div>', $column_class, $p);
            }
            $section_class = 'items-grid wf-container';
            if ($featured_images && $round_images) {
                $section_class .= ' round-images';
            }
            $output = '<section class="' . $section_class . '">' . $output . '</section>';
        }
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $category, 'taxonomy' => 'category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-mini_blog" style="height: 250px;">
					<h5>Mini blog</h4>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
Example #6
0
 public function shortcode($atts, $content = null)
 {
     parent::setup($atts, $content);
     // vc inline dummy
     if ($this->vc_is_inline) {
         $terms_title = _x('Display categories', 'vc inline dummy', 'the7mk2');
         return $this->vc_inline_dummy(array('class' => 'dt_vc-photos_justified_grid', 'title' => _x('Photos Justified Grid', 'vc inline dummy', 'the7mk2'), 'fields' => array($terms_title => presscore_get_terms_list_by_slug(array('slugs' => $this->atts['category'], 'taxonomy' => $this->taxonomy)))));
     }
     return $this->shortcode_html();
 }
Example #7
0
 public function shortcode($atts, $content = null)
 {
     $attributes = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', LANGUAGE_ZONE);
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-albums_justified_grid', 'title' => _x('Albums justified grid', 'vc inline dummy', LANGUAGE_ZONE), 'fields' => array($terms_title => $terms_list)));
     }
     return $this->albums_jsgrid($attributes);
 }
 public function shortcode($atts, $content = null)
 {
     $this->atts = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', 'the7mk2');
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $this->atts['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-portfolio_scroller', 'title' => _x('Portfolio scroller', 'vc inline dummy', 'the7mk2'), 'fields' => array($terms_title => $terms_list)));
     }
     return $this->portfolio_slider();
 }
 public function shortcode($atts, $content = null)
 {
     $attributes = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', LANGUAGE_ZONE);
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-portfolio_jgrid', 'title' => _x('Portfolio justified grid', 'vc inline dummy', LANGUAGE_ZONE), 'fields' => array($terms_title => $terms_list)));
     }
     $output = '';
     $dt_query = $this->get_posts_by_terms(array('orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config($attributes);
         ob_start();
         do_action('presscore_before_shortcode_loop', $this->shortcode_name, $attributes);
         // fullwidth wrap open
         if ($attributes['full_width']) {
             echo '<div class="full-width-wrap">';
         }
         // masonry container open
         echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-portfolio-shortcode')) . presscore_masonry_container_data_atts() . '>';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             presscore_populate_portfolio_config();
             dt_get_template_part('portfolio/masonry/portfolio-masonry-post');
         }
         // masonry container close
         echo '</div>';
         // fullwidth wrap close
         if ($attributes['full_width']) {
             echo '</div>';
         }
         do_action('presscore_after_shortcode_loop', $this->shortcode_name, $attributes);
         $output = ob_get_contents();
         ob_end_clean();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
Example #10
0
        public function shortcode($atts, $content = null)
        {
            $attributes = $this->sanitize_attributes($atts);
            if (presscore_vc_is_inline()) {
                $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_team_category'));
                $dummy = '
					<div class="dt_vc-shortcode_dummy dt_vc-team" style="height: 250px;">
						<h5>Team</h5>
						<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
					</div>
				';
                return $dummy;
            }
            $output = '';
            $dt_query = $this->get_posts_by_terms($attributes);
            if ($dt_query->have_posts()) {
                $this->backup_post_object();
                $this->backup_theme_config();
                $this->setup_config($attributes);
                ob_start();
                do_action('presscore_before_shortcode_loop', $this->shortcode_name, $attributes);
                if ($attributes['full_width']) {
                    echo '<div class="full-width-wrap">';
                }
                echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>';
                while ($dt_query->have_posts()) {
                    $dt_query->the_post();
                    presscore_populate_team_config();
                    dt_get_template_part('team/team-post');
                }
                echo '</div>';
                if ($attributes['full_width']) {
                    echo '</div>';
                }
                do_action('presscore_after_shortcode_loop', $this->shortcode_name, $attributes);
                $output .= ob_get_contents();
                ob_end_clean();
                $this->restore_theme_config();
                $this->restore_post_object();
            }
            return $output;
        }
Example #11
0
 public function shortcode($atts, $content = null)
 {
     $attributes = $this->atts = $this->sanitize_attributes($atts);
     // vc inline dummy
     if (presscore_vc_is_inline()) {
         $terms_title = _x('Display categories', 'vc inline dummy', 'the7mk2');
         $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => $this->taxonomy));
         return $this->vc_inline_dummy(array('class' => 'dt_vc-photos_scroller', 'title' => _x('Photos scroller', 'vc inline dummy', 'the7mk2'), 'fields' => array($terms_title => $terms_list)));
     }
     $output = '';
     $dt_query = $this->get_albums_attachments(array('orderby' => $attributes['orderby'], 'order' => 'DESC', 'number' => $attributes['number'], 'select' => $attributes['select'], 'category' => $attributes['category']));
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config();
         $this->add_hooks();
         ob_start();
         // loop
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             echo '<li class="fs-entry">';
             dt_get_template_part('media/media-masonry-post');
             echo '</li>';
         }
         $posts_html = ob_get_contents();
         ob_end_clean();
         // shape output
         $output = '<div ' . $this->get_container_html_class(array('dt-photos-shortcode', 'slider-wrapper', 'shortcode-instagram', 'dt-gallery-container')) . ' ' . $this->get_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
         $output .= '<div class="frame fullwidth-slider"><ul class="clearfix">' . $posts_html . '</ul></div>';
         if ($attributes['arrows']) {
             $output .= '<div class="prev"><i></i></div><div class="next"><i></i></div>';
         }
         $output .= '</div>';
         // cleanup
         $this->remove_hooks();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
Example #12
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;
    }
Example #13
0
    public function shortcode($atts, $content = null)
    {
        global $post;
        $attributes = shortcode_atts(array('type' => 'masonry', 'category' => '', 'order' => '', 'orderby' => '', 'number' => '6', 'padding' => '5', 'column_width' => '370', 'full_width' => ''), $atts);
        // sanitize attributes
        $attributes['type'] = in_array($attributes['type'], array('masonry', 'grid')) ? $attributes['type'] : 'masonry';
        $attributes['order'] = apply_filters('dt_sanitize_order', $attributes['order']);
        $attributes['orderby'] = apply_filters('dt_sanitize_orderby', $attributes['orderby']);
        $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']);
        $attributes['full_width'] = apply_filters('dt_sanitize_flag', $attributes['full_width']);
        $attributes['padding'] = intval($attributes['padding']);
        $attributes['column_width'] = intval($attributes['column_width']);
        if ($attributes['category']) {
            $attributes['category'] = explode(',', $attributes['category']);
            $attributes['category'] = array_map('trim', $attributes['category']);
            $attributes['select'] = 'only';
        } else {
            $attributes['select'] = 'all';
        }
        $post_backup = $post;
        $dt_query = $this->get_posts_by_terms($attributes);
        $output = '';
        if ($dt_query->have_posts()) {
            $config = Presscore_Config::get_instance();
            // backup and reset config
            $config_backup = $config->get();
            $config->set('layout', $attributes['type']);
            $config->set('template', 'team');
            $config->set('columns', -1);
            $config->set('target_width', $attributes['column_width']);
            // add masonry wrap
            $has_masonry_filters = has_filter('presscore_before_post', 'presscore_before_post_masonry');
            if (!$has_masonry_filters) {
                add_action('presscore_before_post', 'presscore_before_post_masonry', 15);
                add_action('presscore_after_post', 'presscore_after_post_masonry', 15);
            }
            while ($dt_query->have_posts()) {
                $dt_query->the_post();
                ob_start();
                get_template_part('content', 'team');
                $output .= ob_get_contents();
                ob_end_clean();
            }
            // remove masonry wrap
            if (!$has_masonry_filters) {
                remove_action('presscore_before_post', 'presscore_before_post_masonry', 15);
                remove_action('presscore_after_post', 'presscore_after_post_masonry', 15);
            }
            // restore original $post
            $post = $post_backup;
            setup_postdata($post);
            // restore config
            $config->reset($config_backup);
            // masonry layout classes
            $masonry_container_classes = array('wf-container');
            switch ($attributes['type']) {
                case 'grid':
                    $masonry_container_classes[] = 'grid-masonry';
                    break;
                case 'masonry':
                    $masonry_container_classes[] = 'iso-container';
            }
            $masonry_container_classes = implode(' ', $masonry_container_classes);
            $masonry_container_data_attr = array('data-padding="' . intval($attributes['padding']) . 'px"', 'data-width="' . intval($attributes['column_width']) . 'px"');
            // ninjaaaa!
            $masonry_container_data_attr = ' ' . implode(' ', $masonry_container_data_attr);
            // wrap output
            $output = sprintf('<div class="%s"%s>%s</div>', esc_attr($masonry_container_classes), $masonry_container_data_attr, $output);
            if ($attributes['full_width']) {
                $output = '<div class="full-width-wrap">' . $output . '</div>';
            }
        }
        // if have posts
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_team_category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-team" style="height: 250px;">
					<h5>Team</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
Example #14
0
    /**
     * Testimonials slider.
     *
     */
    public function testimonials_slider($attributes = array())
    {
        global $post;
        $dt_query = $this->get_posts_by_terms($attributes);
        $autoslide = absint($attributes['autoslide']);
        $output = '';
        if ($dt_query->have_posts()) {
            $post_backup = $post;
            $output .= '<ul class="testimonials slider-content rsCont"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>' . "\n";
            while ($dt_query->have_posts()) {
                $dt_query->the_post();
                $output .= '<li>' . Presscore_Inc_Testimonials_Post_Type::render_testimonial() . '</li>';
            }
            $post = $post_backup;
            setup_postdata($post);
            $output .= '</ul>' . "\n";
            $output = '<section class="testimonial-item testimonial-item-slider">' . $output . '</section>';
        }
        // if have posts
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_testimonials_category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-testimonials" style="height: 250px;">
					<h5>Testimonials slider</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
Example #15
0
    /**
     * Portfolio masonry.
     *
     */
    public function portfolio_masonry($attributes = array())
    {
        global $post;
        $post_backup = $post;
        $dt_query = $this->get_posts_by_terms($attributes);
        $output = '';
        if ($dt_query->have_posts()) {
            $config = Presscore_Config::get_instance();
            // backup and reset config
            $config_backup = $config->get();
            $config->set('layout', $attributes['type']);
            $config->set('template', 'portfolio');
            $config->set('columns', -1);
            $config->set('show_terms', $attributes['meta_info']);
            $config->set('target_width', $attributes['column_width']);
            $config->set('all_the_same_width', $attributes['same_width']);
            $config->set('under_image_buttons', $attributes['under_image_buttons']);
            $config->set('hover_animation', $attributes['hover_animation']);
            $config->set('hover_bg_color', $attributes['hover_bg_color']);
            $config->set('hover_content_visibility', $attributes['hover_content_visibility']);
            if ('off' != $attributes['descriptions']) {
                $config->set('description', $attributes['descriptions']);
                $config->set('show_links', $attributes['show_link']);
                $config->set('show_titles', $attributes['show_title']);
                $config->set('show_details', $attributes['show_details']);
                $config->set('show_excerpts', $attributes['show_excerpt']);
                $config->set('show_zoom', $attributes['show_zoom']);
            } else {
                $config->set('description', 'under_image');
                $config->set('show_links', false);
                $config->set('show_titles', false);
                $config->set('show_details', false);
                $config->set('show_excerpts', false);
                $config->set('show_zoom', false);
            }
            $details_already_hidden = false;
            if (!$config->get('show_details') && !has_filter('presscore_post_details_link', 'presscore_return_empty_string')) {
                add_filter('presscore_post_details_link', 'presscore_return_empty_string');
                $details_already_hidden = true;
            }
            $before_post_hook_added = false;
            $after_post_hook_added = false;
            // add masonry wrap
            if (!has_filter('presscore_before_post', 'presscore_before_post_masonry')) {
                add_action('presscore_before_post', 'presscore_before_post_masonry', 15);
                $before_post_hook_added = true;
            }
            if (!has_filter('presscore_after_post', 'presscore_after_post_masonry')) {
                add_action('presscore_after_post', 'presscore_after_post_masonry', 15);
                $after_post_hook_added = true;
            }
            // remove proportions filter
            remove_filter('dt_portfolio_thumbnail_args', 'presscore_add_thumbnail_class_for_masonry', 15);
            // add image height filter
            add_filter('dt_portfolio_thumbnail_args', array($this, 'portfolio_image_filter'), 15);
            // loop
            while ($dt_query->have_posts()) {
                $dt_query->the_post();
                ob_start();
                dt_get_template_part('portfolio-masonry-content');
                $output .= ob_get_contents();
                ob_end_clean();
            }
            // remove image height filter
            remove_filter('dt_portfolio_thumbnail_args', array($this, 'portfolio_image_filter'), 15);
            // add proportions filter
            add_filter('dt_portfolio_thumbnail_args', 'presscore_add_thumbnail_class_for_masonry', 15);
            // remove masonry wrap
            if ($before_post_hook_added) {
                remove_action('presscore_before_post', 'presscore_before_post_masonry', 15);
            }
            if ($after_post_hook_added) {
                remove_action('presscore_after_post', 'presscore_after_post_masonry', 15);
            }
            if ($details_already_hidden) {
                // remove details filter
                remove_filter('presscore_post_details_link', 'presscore_return_empty_string');
            }
            // restore original $post
            $post = $post_backup;
            setup_postdata($post);
            // restore config
            $config->reset($config_backup);
            $desc_on_hover = 'under_image' != $attributes['descriptions'];
            // masonry layout classes
            $masonry_container_classes = array('wf-container');
            switch ($attributes['type']) {
                case 'grid':
                    $masonry_container_classes[] = 'portfolio-grid';
                    if ($desc_on_hover) {
                        $masonry_container_classes[] = 'grid-text-hovers';
                        $masonry_container_classes[] = 'description-on-hover';
                    } else {
                        $masonry_container_classes[] = 'description-under-image';
                    }
                    break;
                case 'masonry':
                    $masonry_container_classes[] = 'iso-container';
                    $masonry_container_classes[] = 'layout-masonry';
                    if ($desc_on_hover) {
                        $masonry_container_classes[] = 'layout-masonry-grid';
                        $masonry_container_classes[] = 'description-on-hover';
                    } else {
                        $masonry_container_classes[] = 'description-under-image';
                    }
            }
            // hover classes
            switch ($attributes['descriptions']) {
                case 'on_hoover_centered':
                    $masonry_container_classes[] = 'hover-style-two';
                case 'on_hoover':
                    if ('dark' == $attributes['hover_bg_color']) {
                        $masonry_container_classes[] = 'hover-color-static';
                    }
                    if ('move_to' == $attributes['hover_animation']) {
                        $masonry_container_classes[] = 'cs-style-1';
                    } else {
                        if ('direction_aware' == $attributes['hover_animation']) {
                            $masonry_container_classes[] = 'hover-grid';
                        }
                    }
                    break;
                case 'on_dark_gradient':
                    $masonry_container_classes[] = 'hover-style-one';
                    if ('always' == $attributes['hover_content_visibility']) {
                        $masonry_container_classes[] = 'always-show-info';
                    }
                    break;
                case 'from_bottom':
                    $masonry_container_classes[] = 'hover-style-three';
                    $masonry_container_classes[] = 'cs-style-3';
                    if ('always' == $attributes['hover_content_visibility']) {
                        $masonry_container_classes[] = 'always-show-info';
                    }
                    break;
            }
            $masonry_container_classes = implode(' ', $masonry_container_classes);
            $masonry_container_data_attr = array('data-padding="' . intval($attributes['padding']) . 'px"', 'data-width="' . intval($attributes['column_width']) . 'px"');
            // ninjaaaa!
            $masonry_container_data_attr = ' ' . implode(' ', $masonry_container_data_attr);
            // wrap output
            $output = sprintf('<div class="%s"%s>%s</div>', esc_attr($masonry_container_classes), $masonry_container_data_attr, $output);
            if ($attributes['full_width']) {
                $output = '<div class="full-width-wrap">' . $output . '</div>';
            }
        }
        // if have posts
        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" style="height: 250px;">
					<h5>Portfolio</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
Example #16
0
    /**
     * Blog masonry.
     *
     */
    public function blog_masonry($attributes = array())
    {
        global $post;
        $post_backup = $post;
        $dt_query = $this->get_posts_by_terms($attributes);
        $output = '';
        if ($dt_query->have_posts()) {
            $config = Presscore_Config::get_instance();
            // backup and reset config
            $config_backup = $config->get();
            $config->set('layout', $attributes['type']);
            $config->set('template', 'blog');
            $config->set('columns', -1);
            $config->set('target_width', $attributes['column_width']);
            $config->set('all_the_same_width', $attributes['same_width']);
            $config->set('description', 'under_image');
            $before_post_hook_added = false;
            $after_post_hook_added = false;
            // add masonry wrap
            if (!has_filter('presscore_before_post', 'presscore_before_post_masonry')) {
                add_action('presscore_before_post', 'presscore_before_post_masonry', 15);
                $before_post_hook_added = true;
            }
            if (!has_filter('presscore_after_post', 'presscore_after_post_masonry')) {
                add_action('presscore_after_post', 'presscore_after_post_masonry', 15);
                $after_post_hook_added = true;
            }
            // remove proportions filter
            remove_filter('dt_post_thumbnail_args', 'presscore_add_thumbnail_class_for_masonry', 15);
            // add image height filter
            add_filter('dt_post_thumbnail_args', array($this, 'prop_image_filter'), 15);
            add_filter('presscore_get_images_gallery_hoovered-title_img_args', array($this, 'prop_image_filter'), 15);
            while ($dt_query->have_posts()) {
                $dt_query->the_post();
                ob_start();
                $post_format = get_post_format();
                if ($post_format) {
                    $post_format = 'format-' . $post_format;
                }
                get_template_part('content', $post_format);
                $output .= ob_get_contents();
                ob_end_clean();
            }
            // remove image height filter
            remove_filter('dt_post_thumbnail_args', array($this, 'portfolio_image_filter'), 15);
            remove_filter('presscore_get_images_gallery_hoovered-title_img_args', array($this, 'portfolio_image_filter'), 15);
            // add proportions filter
            add_filter('dt_post_thumbnail_args', 'presscore_add_thumbnail_class_for_masonry', 15);
            // remove masonry wrap
            if ($before_post_hook_added) {
                remove_action('presscore_before_post', 'presscore_before_post_masonry', 15);
            }
            if ($after_post_hook_added) {
                remove_action('presscore_after_post', 'presscore_after_post_masonry', 15);
            }
            // restore original $post
            $post = $post_backup;
            setup_postdata($post);
            // restore config
            $config->reset($config_backup);
            // masonry layout classes
            $masonry_container_classes = array('wf-container', 'shortcode-blog-posts', 'description-under-image');
            switch ($attributes['type']) {
                case 'grid':
                    $masonry_container_classes[] = 'iso-grid';
                    break;
                case 'masonry':
                    $masonry_container_classes[] = 'iso-container';
            }
            $masonry_container_classes = implode(' ', $masonry_container_classes);
            $masonry_container_data_attr = array('data-padding="' . intval($attributes['padding']) . 'px"', 'data-width="' . intval($attributes['column_width']) . 'px"');
            // ninjaaaa!
            $masonry_container_data_attr = ' ' . implode(' ', $masonry_container_data_attr);
            // wrap output
            $output = sprintf('<div class="%s"%s>%s</div>', esc_attr($masonry_container_classes), $masonry_container_data_attr, $output);
            if ($attributes['full_width']) {
                $output = '<div class="full-width-wrap">' . $output . '</div>';
            }
        }
        // if have posts
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-blog" style="height: 250px;">
					<h5>Blog</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }
Example #17
0
    public function shortcode($atts, $content = null)
    {
        $attributes = shortcode_atts(array('category' => '', 'number' => '6', 'orderby' => 'recent', 'height' => '270', 'margin_top' => '', 'margin_bottom' => '', 'width' => '', 'lightbox' => ''), $atts);
        // sanitize attributes
        $attributes['number'] = apply_filters('dt_sanitize_posts_per_page', $attributes['number']);
        $attributes['orderby'] = in_array($attributes['orderby'], array('recent', 'random')) ? $attributes['orderby'] : 'recent';
        $attributes['height'] = absint($attributes['height']);
        $attributes['width'] = absint($attributes['width']);
        $attributes['margin_top'] = $attributes['margin_top'] ? intval($attributes['margin_top']) . 'px' : '';
        $attributes['margin_bottom'] = $attributes['margin_bottom'] ? intval($attributes['margin_bottom']) . 'px' : '';
        // $attributes['arrows'] = apply_filters('dt_sanitize_flag', $attributes['arrows']);
        $attributes['lightbox'] = apply_filters('dt_sanitize_flag', $attributes['lightbox']);
        // $attributes['slider_title'] = wp_kses($content, array());
        if ('recent' == $attributes['orderby']) {
            $attributes['orderby'] = 'date';
        } elseif ('random' == $attributes['orderby']) {
            $attributes['orderby'] = 'rand';
        }
        if ($attributes['category']) {
            $attributes['category'] = explode(',', $attributes['category']);
            $attributes['category'] = array_map('trim', $attributes['category']);
            $attributes['select'] = 'only';
        } else {
            $attributes['select'] = 'all';
        }
        $attachments_ids = array();
        // get albums
        $dt_query = $this->get_posts_by_terms(array_merge($attributes, array('number' => -1)));
        if ($dt_query->have_posts()) {
            // take albums id
            foreach ($dt_query->posts as $dt_post) {
                $album_attachments = get_post_meta($dt_post->ID, '_dt_album_media_items', true);
                if ($album_attachments) {
                    $attachments_ids = array_merge($attachments_ids, $album_attachments);
                }
            }
        }
        if ('rand' == $attributes['orderby']) {
            shuffle($attachments_ids);
        }
        // new query to take attachments
        $attachments_data = presscore_get_attachment_post_data($attachments_ids, 'post__in', 'DESC', $attributes['number']);
        $config = Presscore_Config::get_instance();
        $slider_class = array('shortcode-instagram');
        $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_fields = array();
        /*if ( $attributes['arrows'] ) {
        			$slider_fields[] = 'arrows';
        		}*/
        $sharebuttons = presscore_get_share_buttons_for_prettyphoto('photo');
        $slider_args = array('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style), 'link' => $attributes['lightbox'] ? 'file' : 'none', 'popup' => $attributes['lightbox'] ? 'gallery' : 'none', 'container_attr' => $sharebuttons);
        /*if ( $attributes['slider_title'] ) {
        			$slider_args['title'] = $attributes['slider_title'];
        		}*/
        if ($attributes['height']) {
            $slider_args['height'] = $attributes['height'];
        }
        if ($attributes['width']) {
            $slider_args['img_width'] = $attributes['width'];
        }
        $output = presscore_get_fullwidth_slider_two($attachments_data, $slider_args);
        if (function_exists('vc_is_inline') && vc_is_inline()) {
            $terms_list = presscore_get_terms_list_by_slug(array('slugs' => $attributes['category'], 'taxonomy' => 'dt_gallery_category'));
            $output = '
				<div class="dt_vc-shortcode_dummy dt_vc-photos_scroller" style="height: ' . $slider_args['height'] . 'px;">
					<h5>Photos scroller</h5>
					<p class="text-small"><strong>Display categories:</strong> ' . $terms_list . '</p>
				</div>
			';
        }
        return $output;
    }