Esempio n. 1
0
 protected function shortcode_html()
 {
     $dt_query = $this->get_albums_attachments(array('orderby' => $this->atts['orderby'], 'order' => $this->atts['order'], 'number' => $this->atts['number'], 'select' => $this->atts['select'], 'category' => $this->atts['category']));
     $output = '';
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config();
         ob_start();
         do_action('presscore_before_shortcode_loop', $this->shortcode_name, $this->atts);
         // 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, $this->atts);
         $output = ob_get_contents();
         ob_end_clean();
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
Esempio n. 2
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-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;
 }
Esempio n. 3
0
 protected function albums_jsgrid(&$attributes)
 {
     $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-albums-shortcode')) . presscore_masonry_container_data_atts() . '>';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             presscore_populate_album_post_config();
             dt_get_template_part('albums/masonry/albums-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;
 }
 protected function get_container_html_class($class = array())
 {
     switch ($this->args['arrows']) {
         case 'light':
             $class[] = 'arrows-light';
             break;
         case 'dark':
             $class[] = 'arrows-dark';
             break;
         case 'accent':
             $class[] = 'arrows-accent';
             break;
     }
     $class[] = $this->args['class'];
     $html_class = presscore_masonry_container_class($class);
     $html_class = str_replace(array(' iso-grid', 'iso-grid ', ' loading-effect-fade-in', 'loading-effect-fade-in '), '', $html_class);
     return $html_class;
 }
Esempio n. 5
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;
        }
 protected function the_loop($args = array())
 {
     $default_args = array('masonry_container_class' => array('wf-container'), 'masonry_container_data' => array(), 'post_template_callback' => null, 'query' => null, 'post_type' => $this->post_type, 'taxonomy' => $this->taxonomy, 'select' => 'all', 'show_filter' => false, 'full_width' => false, 'posts_per_page' => '-1');
     $args = wp_parse_args($args, $default_args);
     if (!isset($args['query'], $args['post_template_callback']) || !is_callable($args['post_template_callback'])) {
         return '';
     }
     ob_start();
     do_action('presscore_before_shortcode_loop', $this->shortcode_name, $this->atts);
     // main wrap
     echo '<div class="dt-shortcode with-isotope">';
     // posts filter
     $this->display_posts_filter(array('post_type' => $this->post_type, 'taxonomy' => $this->taxonomy, 'query' => $args['query'], 'select' => $args['select'], 'show_category_filter' => $args['show_filter']));
     // fullwidth wrap open
     if ($args['full_width']) {
         echo '<div class="full-width-wrap">';
     }
     $container_data = array('data-posts-per-page="' . $args['posts_per_page'] . '"');
     $container_data = empty($args['masonry_container_data']) ? $container_data : array_merge($container_data, (array) $args['masonry_container_data']);
     // masonry container open
     echo '<div ' . presscore_masonry_container_class($args['masonry_container_class']) . presscore_masonry_container_data_atts($container_data) . '>';
     while ($args['query']->have_posts()) {
         $args['query']->the_post();
         call_user_func($args['post_template_callback']);
     }
     // masonry container close
     echo '</div>';
     // fullwidth wrap close
     if ($args['full_width']) {
         echo '</div>';
     }
     // pagination
     if ($args['posts_per_page'] > 0) {
         dt_paginator($args['query'], array('class' => 'paginator iso-paginator', 'max_num_pages' => intval(ceil(count($args['query']->posts) / $args['posts_per_page'])), 'posts_per_page' => $args['posts_per_page'], 'paged' => 1));
     }
     // main wrap
     echo '</div>';
     do_action('presscore_after_shortcode_loop', $this->shortcode_name, $this->atts);
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
Esempio n. 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-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;
 }
Esempio n. 8
0
 private function blog_masonry()
 {
     $output = '';
     $dt_query = $this->get_posts_by_terms(array('orderby' => $this->atts['orderby'], 'order' => $this->atts['order'], 'number' => $this->atts['number'], 'select' => $this->atts['select'], 'category' => $this->atts['category']));
     if ($dt_query->have_posts()) {
         $this->backup_post_object();
         $this->backup_theme_config();
         $this->setup_config();
         ob_start();
         do_action('presscore_before_shortcode_loop', $this->shortcode_name, $this->atts);
         // fullwidth wrap open
         if ($this->atts['full_width']) {
             echo '<div class="full-width-wrap">';
         }
         // masonry container open
         echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-blog-shortcode')) . presscore_masonry_container_data_atts() . '>';
         while ($dt_query->have_posts()) {
             $dt_query->the_post();
             presscore_populate_post_config();
             $this->config->set('post.preview.gallery.style', 'hovered_gallery');
             dt_get_template_part('blog/masonry/blog-masonry-post');
         }
         // masonry container close
         echo '</div>';
         // fullwidth wrap close
         if ($this->atts['full_width']) {
             echo '</div>';
         }
         do_action('presscore_after_shortcode_loop', $this->shortcode_name, $this->atts);
         $output = ob_get_contents();
         ob_end_clean();
         // cleanup
         $this->restore_theme_config();
         $this->restore_post_object();
     }
     return $output;
 }
 do_action('presscore_before_loop');
 if (post_password_required()) {
     the_content();
 } else {
     // backup config
     $config_backup = $config->get();
     ///////////////////////
     // Posts Filer //
     ///////////////////////
     presscore_display_posts_filter(array('post_type' => 'post', 'taxonomy' => 'category'));
     // fullwidth wrap open
     if ($config->get('full_width')) {
         echo '<div class="full-width-wrap">';
     }
     // masonry container open
     echo '<div ' . presscore_masonry_container_class(array('wf-container')) . presscore_masonry_container_data_atts() . '>';
     //////////////////////
     // Custom loop //
     //////////////////////
     $page_query = presscore_get_blog_query();
     if ($page_query->have_posts()) {
         while ($page_query->have_posts()) {
             $page_query->the_post();
             // populate config with current post settings
             presscore_populate_post_config();
             presscore_get_template_part('theme', 'blog/masonry/blog-masonry-post');
         }
         wp_reset_postdata();
     }
     // masonry container close
     echo '</div>';
 if (have_posts()) {
     while (have_posts()) {
         the_post();
         // main loop
         do_action('presscore_before_loop');
         if (post_password_required()) {
             the_content();
         } else {
             // backup config
             $config_backup = $config->get();
             // fullwidth wrap open
             if ($config->get('full_width')) {
                 echo '<div class="full-width-wrap">';
             }
             // masonry container open
             echo '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-gallery-container')) . presscore_masonry_container_data_atts() . presscore_get_share_buttons_for_prettyphoto('photo') . '>';
             //////////////////////
             // Custom loop //
             //////////////////////
             if (function_exists('presscore_mod_albums_get_photos')) {
                 $page_query = presscore_mod_albums_get_photos();
                 if ($page_query->have_posts()) {
                     while ($page_query->have_posts()) {
                         $page_query->the_post();
                         presscore_get_template_part('mod_albums', 'photo-masonry/photo');
                     }
                     wp_reset_postdata();
                 }
             }
             // masonry container close
             echo '</div>';
Esempio n. 11
0
 /**
  * Portfolio masonry.
  *
  */
 public function portfolio_masonry()
 {
     global $post;
     $post_backup = $post;
     $dt_query = $this->get_posts_by_terms($this->atts);
     $output = '';
     if ($dt_query->have_posts()) {
         $config = Presscore_Config::get_instance();
         // backup and reset config
         $config_backup = $config->get();
         $this->setup_config();
         $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();
             // populate post config
             presscore_populate_portfolio_config();
             ob_start();
             dt_get_template_part('portfolio/masonry/portfolio-masonry-post');
             $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');
         }
         $output = '<div ' . presscore_masonry_container_class(array('wf-container', 'dt-portfolio-shortcode')) . presscore_masonry_container_data_atts() . '>' . $output . '</div>';
         if ($this->atts['full_width']) {
             $output = '<div class="full-width-wrap">' . $output . '</div>';
         }
         // restore original $post
         $post = $post_backup;
         setup_postdata($post);
         // restore config
         $config->reset($config_backup);
     }
     // if have posts
     return $output;
 }