function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, self::$widget_defaults);
     /* Our variables from the widget settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_testimonials', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_testimonials_category', 'field' => 'term_id', 'terms' => $instance['cats'])));
     switch ($instance['select']) {
         case 'only':
             $args['tax_query'][0]['operator'] = 'IN';
             break;
         case 'except':
             $args['tax_query'][0]['operator'] = 'NOT IN';
             break;
         default:
             unset($args['tax_query']);
     }
     $p_query = new WP_Query($args);
     $autoslide = absint($instance['autoslide']);
     echo $before_widget . "\n";
     // title
     if ($title) {
         echo $before_title . $title . $after_title . "\n";
     }
     if ($p_query->have_posts()) {
         update_post_thumbnail_cache($p_query);
         echo '<ul class="testimonials slider-content rsContW"' . ($autoslide ? ' data-autoslide="' . $autoslide . '"' : '') . '>', "\n";
         while ($p_query->have_posts()) {
             $p_query->the_post();
             echo '<li>' . Presscore_Inc_Testimonials_Post_Type::render_testimonial() . '</li>';
         }
         // while have posts
         wp_reset_postdata();
         echo '</ul>', "\n";
     }
     // if have posts
     echo $after_widget . "\n";
 }
Exemplo n.º 2
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;
        }
<?php

/**
 * Testimonials content.
 *
 * @since presscore 1.0
 */
// File Security Check
if (!defined('ABSPATH')) {
    exit;
}
?>

<?php 
do_action('presscore_before_post');
?>

<div class="testimonial-item">
	<?php 
echo Presscore_Inc_Testimonials_Post_Type::render_testimonial();
?>
</div>

<?php 
do_action('presscore_after_post');
Exemplo n.º 4
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;
    }