예제 #1
0
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false);
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Defines layout type
     $cpt_layout_class = $this->post_type . '-multiple clearfix type-multiple';
     $multiple = true;
     // Single post type or many single post types
     if ('' != $id) {
         if (strpos($id, ',')) {
             $ids = explode(',', str_replace(' ', '', $id));
             foreach ($ids as $string_id) {
                 $int_ids[] = intval($string_id);
             }
             $args['post__in'] = $int_ids;
             $args['orderby'] = 'post__in';
         } else {
             $args['p'] = intval($id);
             $cpt_layout_class = $this->post_type . '-single';
             $multiple = false;
         }
     }
     // Get posts according to parameters
     $posts = get_posts(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         $themify_save = clone $themify;
         // save a copy
         // override $themify object
         $themify->hide_title = $title;
         $themify->hide_image = $image;
         if (!$multiple) {
             if ('' == $image_w || get_post_meta($args['p'], 'image_width', true)) {
                 $themify->width = get_post_meta($args['p'], 'image_width', true);
             }
             if ('' == $image_h || get_post_meta($args['p'], 'image_height', true)) {
                 $themify->height = get_post_meta($args['p'], 'image_height', true);
             }
         } else {
             $themify->width = $image_w;
             $themify->height = $image_h;
         }
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $themify->col_class = $this->column_class($style);
         $out .= '<div class="loops-wrapper shortcode ' . $post_type . ' ' . $style . ' ' . $cpt_layout_class . '">';
         $out .= themify_get_shortcode_template($posts, 'includes/loop-highlight', 'index');
         $out .= $this->section_link($more_link, $more_text, $post_type);
         $out .= '</div>';
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     return $out;
 }
 /**
  * Main shortcode rendering
  * @param array $atts
  * @param $post_type
  * @return string|void
  */
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Pagination
     global $paged;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'paged' => $paged);
     // Category parameters
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Defines layout type
     $cpt_layout_class = $this->post_type . '-multiple clearfix type-multiple';
     $multiple = true;
     // Single post type or many single post types
     if ('' != $id) {
         if (strpos($id, ',')) {
             $ids = explode(',', str_replace(' ', '', $id));
             foreach ($ids as $string_id) {
                 $int_ids[] = intval($string_id);
             }
             $args['post__in'] = $int_ids;
             $args['orderby'] = 'post__in';
         } else {
             $args['p'] = intval($id);
             $cpt_layout_class = $this->post_type . '-single';
             $multiple = false;
         }
     }
     // Get posts according to parameters
     $portfolio_query = new WP_Query();
     $posts = $portfolio_query->query(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Grid Style
     if ('' == $style) {
         $style = themify_check('setting-default_portfolio_index_post_layout') ? themify_get('setting-default_portfolio_index_post_layout') : 'grid4';
     }
     if (is_singular('portfolio')) {
         if ('' == $image_w) {
             $image_w = themify_check('setting-default_portfolio_single_image_post_width') ? themify_get('setting-default_portfolio_single_image_post_width') : '670';
         }
         if ('' == $image_h) {
             $image_h = themify_check('setting-default_portfolio_single_image_post_height') ? themify_get('setting-default_portfolio_single_image_post_height') : '0';
         }
         if ('' == $post_date) {
             $post_date = themify_check('setting-default_portfolio_single_post_date') ? themify_get('setting-default_portfolio_index_post_date') : 'yes';
         }
         if ('' == $title) {
             $title = themify_check('setting-default_portfolio_single_title') ? themify_get('setting-default_portfolio_single_title') : 'yes';
         }
         if ('' == $unlink_title) {
             $unlink_title = themify_check('setting-default_portfolio_single_unlink_post_title') ? themify_get('setting-default_portfolio_single_unlink_post_title') : 'no';
         }
         if ('' == $post_meta) {
             $post_meta = themify_check('setting-default_portfolio_single_meta') ? themify_get('setting-default_portfolio_single_meta') : 'yes';
         }
     } else {
         if ('' == $image_w) {
             $image_w = themify_check('setting-default_portfolio_index_image_post_width') ? themify_get('setting-default_portfolio_index_image_post_width') : '221';
         }
         if ('' == $image_h) {
             $image_h = themify_check('setting-default_portfolio_index_image_post_height') ? themify_get('setting-default_portfolio_index_image_post_height') : '221';
         }
         if ('' == $title) {
             $title = themify_check('setting-default_portfolio_index_title') ? themify_get('setting-default_portfolio_index_title') : 'yes';
         }
         if ('' == $unlink_title) {
             $unlink_title = themify_check('setting-default_portfolio_index_unlink_post_title') ? themify_get('setting-default_portfolio_index_unlink_post_title') : 'no';
         }
         // Reverse logic
         if ('' == $post_date) {
             $post_date = themify_check('setting-default_portfolio_index_post_date') ? 'no' == themify_get('setting-default_portfolio_index_post_date') ? 'yes' : 'no' : 'no';
         }
         if ('' == $post_meta) {
             $post_meta = themify_check('setting-default_portfolio_index_post_meta_category') ? 'no' == themify_get('setting-default_portfolio_index_post_meta_category') ? 'yes' : 'no' : 'no';
         }
     }
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         $themify_save = clone $themify;
         // save a copy
         // override $themify object
         $themify->hide_title = 'yes' == $title ? 'no' : 'yes';
         $themify->unlink_title = '' == $unlink_title || 'no' == $unlink_title ? 'no' : 'yes';
         $themify->hide_image = 'yes' == $image ? 'no' : 'yes';
         $themify->hide_meta = 'yes' == $post_meta ? 'no' : 'yes';
         $themify->hide_date = 'yes' == $post_date ? 'no' : 'yes';
         if (!$multiple) {
             if ('' == $image_w || get_post_meta($args['p'], 'image_width', true)) {
                 $themify->width = get_post_meta($args['p'], 'image_width', true);
             }
             if ('' == $image_h || get_post_meta($args['p'], 'image_height', true)) {
                 $themify->height = get_post_meta($args['p'], 'image_height', true);
             }
         } else {
             $themify->width = $image_w;
             $themify->height = $image_h;
         }
         $themify->use_original_dimensions = 'yes' == $use_original_dimensions ? 'yes' : 'no';
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $themify->portfolio_instance = $this->instance;
         $out .= '<div class="loops-wrapper shortcode ' . $post_type . ' ' . $style . ' ' . $cpt_layout_class . '">';
         $out .= themify_get_shortcode_template($posts, 'includes/loop-portfolio', 'index');
         $out .= $this->section_link($more_link, $more_text, $post_type);
         $out .= '</div>';
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     return $out;
 }
    $themify->width = $img_width_testimonial;
    $themify->height = $img_height_testimonial;
    $themify->image_setting = 'ignore=true&';
    if ($this->is_img_php_disabled()) {
        $themify->image_setting .= $image_size_testimonial != '' ? 'image_size=' . $image_size_testimonial . '&' : '';
    }
    $themify->unlink_title = $unlink_post_title_testimonial;
    $themify->display_content = $display_testimonial;
    $themify->hide_date = $hide_post_date_testimonial;
    $themify->hide_meta = $hide_post_meta_testimonial;
    $themify->post_layout = $layout_testimonial;
    // hooks action
    do_action_ref_array('themify_builder_override_loop_themify_vars', array($themify, $mod_name));
    $out = '';
    if ($posts) {
        $out .= themify_get_shortcode_template($posts, 'includes/loop', 'testimonial');
    }
    // revert to original $themify state
    $themify = clone $themify_save;
    echo $out;
} else {
    // use builder template
    global $post;
    $temp_post = $post;
    foreach ($posts as $post) {
        setup_postdata($post);
        ?>

		<?php 
        themify_post_before();
        // hook
    $themify->image_setting = 'ignore=true&';
    if ($this->is_img_php_disabled()) {
        $themify->image_setting .= $image_size_portfolio != '' ? 'image_size=' . $image_size_portfolio . '&' : '';
    }
    $themify->unlink_title = $unlink_post_title_portfolio;
    $themify->display_content = $display_portfolio;
    $themify->hide_date = $hide_post_date_portfolio;
    $themify->hide_meta = $hide_post_meta_portfolio;
    $themify->post_layout = $layout_portfolio;
    $themify->feature = $portfolio_feature;
    $themify->portfolio_expander = $portfolio_expander;
    // hooks action
    do_action_ref_array('themify_builder_override_loop_themify_vars', array($themify, $mod_name));
    $out = '';
    if ($posts) {
        $out .= themify_get_shortcode_template($posts, 'includes/loop', 'portfolio');
    }
    // revert to original $themify state
    $themify = clone $themify_save;
    echo $out;
} else {
    // use builder template
    global $post;
    $temp_post = $post;
    foreach ($posts as $post) {
        setup_postdata($post);
        ?>

		<?php 
        themify_post_before();
        // hook
예제 #5
0
/**
 * List posts using get_posts
 * @param Object $atts
 * @param String $content
 * @return String
 */
function themify_shortcode_list_posts($atts, $content = null)
{
    global $themify;
    // Set defaults for featured image in different layouts
    $default_size = array('image_w' => 1160, 'image_h' => 665);
    if (isset($atts['style'])) {
        switch ($atts['style']) {
            case 'grid4':
                $default_size['image_w'] = 260;
                $default_size['image_h'] = 150;
                break;
            case 'grid3':
                $default_size['image_w'] = 360;
                $default_size['image_h'] = 205;
                break;
            case 'grid2':
                $default_size['image_w'] = 561;
                $default_size['image_h'] = 321;
                break;
            case 'list-thumb-image':
                $default_size['image_w'] = 260;
                $default_size['image_h'] = 150;
                break;
            case 'grid2-thumb':
                $default_size['image_w'] = 160;
                $default_size['image_h'] = 95;
                break;
            case 'list-post':
            default:
                $default_size['image_w'] = 1160;
                $default_size['image_h'] = 665;
                break;
        }
    }
    extract(shortcode_atts(array('title' => 'yes', 'category' => '0', 'limit' => '5', 'offset' => '0', 'more_text' => __('More...', 'themify'), 'excerpt_length' => '', 'image' => 'yes', 'image_w' => $default_size['image_w'], 'image_h' => $default_size['image_h'], 'display' => 'none', 'style' => 'list-post', 'post_date' => 'no', 'post_meta' => 'no', 'unlink_title' => 'no', 'unlink_image' => 'no', 'image_size' => 'medium', 'post_type' => 'post', 'taxonomy' => 'category', 'order' => 'DESC', 'orderby' => 'date'), $atts, 'themify_list_posts'));
    if ('post' != $post_type && 'category' == $taxonomy) {
        $taxonomy = $post_type . '-category';
    }
    $query_args = array('numberposts' => $limit, 'offset' => $offset, 'post_type' => $post_type, 'taxonomy' => $taxonomy, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'post__not_in' => !is_home() ? array(get_the_ID()) : array());
    if ('0' != $category) {
        $tax_query_terms = explode(',', $category);
        if (preg_match('#[a-z]#', $category)) {
            $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms));
        } else {
            $exclude = array_filter($tax_query_terms, 'themify_is_negative_number');
            $query_args['tax_query'] = array('relation' => 'AND', array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_filter($tax_query_terms, 'themify_is_positive_number')), array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => array_map('themify_make_absolute_number', $exclude), 'operator' => 'NOT IN'));
        }
    }
    $posts = get_posts(apply_filters('themify_list_posts_shortcode_query_args', $query_args, $atts));
    // save a copy
    $themify_save = clone $themify;
    // override $themify object
    $themify->hide_image = 'yes' == $image ? 'no' : 'yes';
    $themify->unlink_image = $unlink_image;
    $themify->hide_title = 'yes' == $title ? 'no' : 'yes';
    $themify->width = $image_w;
    $themify->height = $image_h;
    $themify->image_setting = 'ignore=true&';
    $themify->unlink_title = $unlink_title;
    $themify->display_content = $display;
    $themify->hide_date = 'yes' == $post_date ? 'no' : 'yes';
    $themify->hide_meta = 'yes' == $post_meta ? 'no' : 'yes';
    $themify->post_layout = $style;
    $themify->is_shortcode = true;
    $themify->image_size = $image_size;
    $out = '';
    if ($posts) {
        $out = '<!-- shortcode list_posts --><div class="loops-wrapper shortcode clearfix list-posts layout ' . esc_attr($style) . ' ">';
        $out .= themify_get_shortcode_template($posts, 'includes/loop', $post_type);
        $out .= '</div><!-- /shortcode list_posts -->';
    }
    // revert to original $themify state
    $themify = clone $themify_save;
    return $out;
}
예제 #6
0
    $themify->hide_title = $hide_post_title_highlight;
    $themify->width = $img_width_highlight;
    $themify->height = $img_height_highlight;
    $themify->image_setting = 'ignore=true&';
    if ($this->is_img_php_disabled()) {
        $themify->image_setting .= $image_size_highlight != '' ? 'image_size=' . $image_size_highlight . '&' : '';
    }
    $themify->display_content = $display_highlight;
    $themify->hide_date = $hide_post_date_highlight;
    $themify->hide_meta = $hide_post_meta_highlight;
    $themify->post_layout = $layout_highlight;
    // hooks action
    do_action_ref_array('themify_builder_override_loop_themify_vars', array($themify, $mod_name));
    $out = '';
    if ($posts) {
        $out .= themify_get_shortcode_template($posts, 'includes/loop', 'highlight');
    }
    // revert to original $themify state
    $themify = clone $themify_save;
    echo $out;
} else {
    // use builder template
    global $post;
    foreach ($posts as $post) {
        setup_postdata($post);
        ?>

			<?php 
        themify_post_before();
        // hook
        ?>
예제 #7
0
 /**
  * Main shortcode rendering
  * @param array $atts
  * @param $post_type
  * @return string|void
  */
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false);
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Defines layout type
     $cpt_layout_class = $this->post_type . '-multiple clearfix type-multiple';
     $multiple = true;
     // Single post type or many single post types
     if ('' != $id) {
         if (strpos($id, ',')) {
             // Multiple ////////////////////////////////////
             $ids = explode(',', str_replace(' ', '', $id));
             foreach ($ids as $string_id) {
                 $int_ids[] = intval($string_id);
             }
             $args['post__in'] = $int_ids;
             $args['orderby'] = 'post__in';
         } else {
             // Single ///////////////////////////////////////
             $args['p'] = intval($id);
             $cpt_layout_class = $this->post_type . '-single';
             $multiple = false;
         }
     }
     // Get posts according to parameters
     $posts = get_posts(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         // save a copy
         $themify_save = clone $themify;
         // override $themify object
         // set image link
         $themify->unlink_image = '' == $unlink_image || 'no' == $unlink_image ? 'no' : 'yes';
         $themify->hide_image = 'yes' == $image ? 'no' : 'yes';
         // set title link
         $themify->unlink_title = '' == $unlink_title || 'no' == $unlink_title ? 'no' : 'yes';
         $themify->hide_title = 'yes' == $title ? 'no' : 'yes';
         $themify->use_original_dimensions = 'yes' == $use_original_dimensions ? 'yes' : 'no';
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $themify->col_class = $this->column_class($style);
         if (!$multiple) {
             if ('' == $image_w || get_post_meta($args['p'], 'image_width', true)) {
                 $themify->width = get_post_meta($args['p'], 'image_width', true);
             }
             if ('' == $image_h || get_post_meta($args['p'], 'image_height', true)) {
                 $themify->height = get_post_meta($args['p'], 'image_height', true);
             }
         } else {
             $themify->width = $image_w;
             $themify->height = $image_h;
             $themify->skills = get_post_meta(get_the_ID(), 'skills', true);
             $themify->social = get_post_meta(get_the_ID(), 'social', true);
         }
         if (is_singular('team')) {
             $teampre = 'setting-default_team_single_';
             $themify->hide_image = themify_check($teampre . 'hide_image') ? themify_get($teampre . 'hide_image') : 'no';
             $themify->hide_title = themify_check($teampre . 'hide_title') ? themify_get($teampre . 'hide_title') : 'no';
             $themify->unlink_image = themify_check($teampre . 'unlink_image') ? themify_get($teampre . 'unlink_image') : 'no';
             $themify->unlink_title = themify_check($teampre . 'unlink_title') ? themify_get($teampre . 'unlink_title') : 'no';
             $themify->width = themify_check($teampre . 'image_post_width') ? themify_get($teampre . 'image_post_width') : 144;
             $themify->height = themify_check($teampre . 'image_post_height') ? themify_get($teampre . 'image_post_height') : 144;
         }
         $out .= '<div class="loops-wrapper shortcode ' . $post_type . ' ' . $style . ' ' . $cpt_layout_class . '">';
         $out .= themify_get_shortcode_template($posts, 'includes/loop-team', 'index');
         $out .= $this->section_link($more_link, $more_text, $post_type);
         $out .= '</div>';
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     return $out;
 }
예제 #8
0
    $themify->height = $img_height_post;
    $themify->image_setting = 'ignore=true&';
    $themify->is_builder_loop = true;
    if ($this->is_img_php_disabled()) {
        $themify->image_setting .= $image_size_post != '' ? 'image_size=' . $image_size_post . '&' : '';
    }
    $themify->unlink_title = $unlink_post_title_post;
    $themify->display_content = $display_post;
    $themify->hide_date = $hide_post_date_post;
    $themify->hide_meta = $hide_post_meta_post;
    $themify->post_layout = $layout_post;
    // hooks action
    do_action_ref_array('themify_builder_override_loop_themify_vars', array($themify, $mod_name));
    $out = '';
    if ($posts) {
        $out .= themify_get_shortcode_template($posts);
    }
    // revert to original $themify state
    $themify = clone $themify_save;
    echo !empty($out) ? $out : '';
} else {
    // use builder template
    global $post;
    $temp_post = $post;
    foreach ($posts as $post) {
        setup_postdata($post);
        ?>

		<?php 
        themify_post_before();
        // hook
예제 #9
0
/**
 * List posts using get_posts
 * @param Object $atts
 * @param String $content
 * @return String
 */
function themify_shortcode_list_posts($atts, $content = null)
{
    global $themify;
    wp_enqueue_script('themify-shortcodes-js');
    extract(shortcode_atts(array('title' => 'yes', 'category' => '0', 'limit' => '5', 'more_text' => __('More...', 'themify'), 'excerpt_length' => '', 'image' => 'yes', 'image_w' => '220', 'image_h' => '150', 'display' => 'none', 'style' => 'list-post', 'post_date' => 'no', 'post_meta' => 'no', 'unlink_title' => 'no', 'unlink_image' => 'no', 'image_size' => 'thumbnail', 'post_type' => 'post', 'taxonomy' => 'category', 'order' => 'DESC', 'orderby' => 'date'), $atts));
    if ('post' != $post_type && 'category' == $taxonomy) {
        $taxonomy = $post_type . '-category';
    }
    $query_args = array('numberposts' => $limit, 'post_type' => $post_type, 'taxonomy' => $taxonomy, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false, 'post__not_in' => array(get_the_ID()));
    if ('0' != $category) {
        $tax_query_terms = explode(',', $category);
        if (preg_match('#[a-z]#', $category)) {
            $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $tax_query_terms));
        } else {
            $query_args['tax_query'] = array(array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $tax_query_terms));
        }
    }
    $posts = get_posts($query_args);
    // save a copy
    $themify_save = clone $themify;
    // override $themify object
    $themify->hide_image = 'yes' == $image ? 'no' : 'yes';
    $themify->unlink_image = $unlink_image;
    $themify->hide_title = 'yes' == $title ? 'no' : 'yes';
    $themify->width = $image_w;
    $themify->height = $image_h;
    $themify->image_setting = 'ignore=true&';
    $themify->unlink_title = $unlink_title;
    $themify->display_content = $display;
    $themify->hide_date = 'yes' == $post_date ? 'no' : 'yes';
    $themify->hide_meta = 'yes' == $post_meta ? 'no' : 'yes';
    $themify->post_layout = $style;
    $out = '';
    if ($posts) {
        $out = '<!-- shortcode list_posts --><div class="loops-wrapper shortcode clearfix list-posts layout ' . $style . ' ">';
        $out .= themify_get_shortcode_template($posts, 'includes/loop', $post_type);
        $out .= '</div><!-- /shortcode list_posts -->';
    }
    // revert to original $themify state
    $themify = clone $themify_save;
    return $out;
}
 /**
  * Main shortcode rendering
  * @param array $atts
  * @param $post_type
  * @return string|void
  */
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => $orderby, 'suppress_filters' => false);
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Defines layout type
     $cpt_layout_class = $this->post_type . '-multiple clearfix type-multiple';
     $multiple = true;
     // Single post type or many single post types
     if ('' != $id) {
         if (strpos($id, ',')) {
             $ids = explode(',', str_replace(' ', '', $id));
             foreach ($ids as $string_id) {
                 $int_ids[] = intval($string_id);
             }
             $args['post__in'] = $int_ids;
             $args['orderby'] = 'post__in';
         } else {
             $args['p'] = intval($id);
             $cpt_layout_class = $this->post_type . '-single';
             $multiple = false;
         }
     }
     // Get posts according to parameters
     $posts = get_posts(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         $themify_save = clone $themify;
         // save a copy
         // override $themify object
         $themify->hide_title = $title;
         $themify->hide_image = $image;
         if (!$multiple) {
             if ('' == $image_w || get_post_meta($args['p'], 'image_width', true)) {
                 $themify->width = get_post_meta($args['p'], 'image_width', true);
             }
             if ('' == $image_h || get_post_meta($args['p'], 'image_height', true)) {
                 $themify->height = get_post_meta($args['p'], 'image_height', true);
             }
         } else {
             $themify->width = $image_w;
             $themify->height = $image_h;
         }
         $themify->use_original_dimensions = 'yes' == $use_original_dimensions ? 'yes' : 'no';
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $slider_id = 'slider' == $style ? 'id="testimonial-slider-' . $this->instance . '"' : '';
         $out .= '<div ' . $slider_id . ' class="loops-wrapper shortcode ' . $post_type . ' ' . $style . ' ' . $cpt_layout_class . '">';
         if ('slider' == $style) {
             $option = 'setting-testimonial_slider';
             $out .= sprintf('<div class="slideshow-wrap"><ul class="slideshow" data-id="testimonial-slider-%s" data-autoplay="%s" data-effect="%s" data-speed="%s">', $this->instance, themify_check($option . '_autoplay') ? themify_get($option . '_autoplay') : '4000', themify_check($option . '_effect') ? themify_get($option . '_effect') : 'scroll', themify_check($option . '_transition_speed') ? themify_get($option . '_transition_speed') : '500');
         }
         $out .= themify_get_shortcode_template($posts, 'includes/loop-testimonial', 'index');
         if ('slider' == $style) {
             $out .= '</ul></div>';
         }
         $out .= $this->section_link($more_link, $more_text, $post_type);
         $out .= '</div>';
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     $this->instance++;
     return $out;
 }
예제 #11
0
 /**
  * Main shortcode rendering
  * @param array $atts
  * @param $post_type
  * @return string|void
  */
 function shortcode($atts = array(), $post_type)
 {
     extract($atts);
     // Parameters to get posts
     $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'order' => $order, 'orderby' => 'date', 'suppress_filters' => false);
     $args['tax_query'] = $this->parse_category_args($category, $post_type);
     // Get posts according to parameters
     $posts = get_posts(apply_filters('themify_' . $post_type . '_shortcode_args', $args));
     // Collect markup to be returned
     $out = '';
     if ($posts) {
         global $themify;
         // save a copy
         $themify_save = clone $themify;
         // override $themify object
         $themify->hide_title = $title;
         $themify->hide_image = $image;
         $themify->width = $image_w;
         $themify->height = $image_h;
         $themify->use_original_dimensions = 'yes' == $use_original_dimensions ? 'yes' : 'no';
         $themify->display_content = $display;
         $themify->more_link = $more_link;
         $themify->more_text = $more_text;
         $themify->post_layout = $style;
         $out .= '<div class="loops-wrapper shortcode ' . $post_type . '"><ul>';
         $out .= themify_get_shortcode_template($posts, 'includes/loop-timeline', 'index');
         $out .= "</ul>\n</div>\n<!-- /.loops-wrapper.timeline -->";
         $themify = clone $themify_save;
         // revert to original $themify state
     }
     return $out;
 }