Exemplo n.º 1
0
 /**
  * Display related projects.
  *
  */
 function presscore_display_related_projects()
 {
     global $post;
     $html = '';
     // if related projects turn on in theme options
     if (of_get_option('general-show_rel_projects', false)) {
         $terms = array();
         switch (get_post_meta($post->ID, '_dt_project_options_related_mode', true)) {
             case 'custom':
                 $terms = get_post_meta($post->ID, '_dt_project_options_related_categories', true);
                 break;
             default:
                 $terms = wp_get_object_terms($post->ID, 'dt_portfolio_category', array('fields' => 'ids'));
         }
         if ($terms && !is_wp_error($terms)) {
             $config = Presscore_Config::get_instance();
             $attachments_data = presscore_get_related_posts(array('cats' => $terms, 'post_type' => 'dt_portfolio', 'taxonomy' => 'dt_portfolio_category', 'args' => array('posts_per_page' => intval(of_get_option('general-rel_projects_max', 12)))));
             $img_width = null;
             $slider_title = of_get_option('general-rel_projects_head_title', 'Related projects');
             $slider_class = 'related-projects';
             if ('disabled' != get_post_meta($post->ID, '_dt_sidebar_position', true)) {
                 $height = of_get_option('general-rel_projects_height', 190);
                 if ('fixed' == of_get_option('general-rel_projects_width_style')) {
                     $img_width = of_get_option('general-rel_projects_width');
                 }
             } else {
                 $height = of_get_option('general-rel_projects_fullwidth_height', 270);
                 $slider_class .= ' full';
                 if ('fixed' == of_get_option('general-rel_projects_fullwidth_width_style')) {
                     $img_width = of_get_option('general-rel_projects_fullwidth_width');
                 }
             }
             $slider_fields = array();
             // if ( of_get_option('general-rel_projects_meta', true) ) {
             /*if ( of_get_option('general-rel_projects_arrows', true) ) {
             			$slider_fields[] = 'arrows';
             		}*/
             if (of_get_option('general-rel_projects_title', true)) {
                 $slider_fields[] = 'title';
             }
             if (of_get_option('general-rel_projects_meta', true)) {
                 $slider_fields[] = 'meta';
             }
             if (of_get_option('general-rel_projects_excerpt', true)) {
                 $slider_fields[] = 'description';
             }
             if (of_get_option('general-rel_projects_link', true)) {
                 $slider_fields[] = 'link';
             }
             if (of_get_option('general-rel_projects_details', true)) {
                 $slider_fields[] = 'details';
             }
             // }
             $html = presscore_get_fullwidth_slider_two($attachments_data, array('class' => $slider_class, 'title' => $slider_title, 'fields' => $slider_fields, 'height' => $height, 'img_width' => $img_width));
             if ('disabled' != $config->get('sidebar_position')) {
                 $html = '<div class="hr-thick"></div>' . $html;
                 if (presscore_comments_will_be_displayed()) {
                     $html .= '<div class="gap-10"></div><div class="hr-thick"></div><div class="gap-30"></div>';
                 }
             }
         }
     }
     echo (string) apply_filters('presscore_display_related_projects', $html);
 }
Exemplo n.º 2
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);
             }
         }
     }
     // 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;
 }
Exemplo n.º 3
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_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('fields' => $slider_fields, 'class' => $slider_class, 'style' => implode(';', $slider_style));
     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;
 }
Exemplo n.º 4
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;
    }
Exemplo 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' => $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;
        }