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
 function presscore_register_post_types()
 {
     Presscore_Inc_Portfolio_Post_Type::register();
     Presscore_Inc_Testimonials_Post_Type::register();
     Presscore_Inc_Team_Post_Type::register();
     Presscore_Inc_Logos_Post_Type::register();
     Presscore_Inc_Benefits_Post_Type::register();
     Presscore_Inc_Albums_Post_Type::register();
     Presscore_Inc_Slideshow_Post_Type::register();
 }
Exemplo n.º 3
0
 function presscore_testimonials_ajax_loading_responce($ajax_data = array())
 {
     global $post, $wp_query, $paged, $page;
     extract($ajax_data);
     if (!$nonce || !$post_id || !$post_paged || !$target_page || !wp_verify_nonce($nonce, 'presscore-posts-ajax')) {
         $responce = array('success' => false, 'reason' => 'corrupted data');
     } else {
         require_once PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php';
         require_once PRESSCORE_DIR . '/template-hooks.php';
         require_once PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php';
         // get page
         query_posts(array('post_type' => 'page', 'page_id' => $post_id, 'post_status' => 'publish', 'page' => $target_page));
         if (have_posts() && !post_password_required()) {
             while (have_posts()) {
                 the_post();
                 // main loop
                 $config = presscore_get_config();
                 $config->set('template', 'testimonials');
                 $config->set('template.layout.type', 'masonry');
                 presscore_config_base_init();
                 do_action('presscore_before_loop');
                 $query = Presscore_Inc_Testimonials_Post_Type::get_template_query();
                 $html = '';
                 ob_start();
                 if ($query->have_posts()) {
                     while ($query->have_posts()) {
                         $query->the_post();
                         /*
                         						// check if current post already loaded
                         						$key_in_loaded = array_search( $post->ID, $loaded_items );
                         						if ( false !== $key_in_loaded ) {
                         							unset( $loaded_items[ $key_in_loaded ] );
                         							continue;
                         						}
                         */
                         // post template
                         get_template_part('content', 'testimonials');
                     }
                     wp_reset_postdata();
                 }
                 $html .= ob_get_clean();
             }
             $responce = array('success' => true);
             ///////////////////
             // pagination //
             ///////////////////
             $next_page_link = dt_get_next_posts_url($query->max_num_pages);
             if ($next_page_link) {
                 $responce['nextPage'] = dt_get_paged_var() + 1;
             } else {
                 $responce['nextPage'] = 0;
             }
             $load_style = $config->get('load_style');
             // pagination style
             if (presscore_is_load_more_pagination()) {
                 $pagination = dt_get_next_page_button($query->max_num_pages, 'paginator paginator-more-button with-ajax');
                 if ($pagination) {
                     $responce['currentPage'] = dt_get_paged_var();
                     $responce['paginationHtml'] = $pagination;
                 } else {
                     $responce['currentPage'] = $post_paged;
                 }
                 $responce['paginationType'] = 'more';
             } else {
                 if ('ajax_pagination' == $load_style) {
                     ob_start();
                     dt_paginator($query, array('class' => 'paginator with-ajax', 'ajaxing' => true));
                     $pagination = ob_get_clean();
                     if ($pagination) {
                         $responce['paginationHtml'] = $pagination;
                     }
                     $responce['paginationType'] = 'paginator';
                 }
             }
             /////////////////
             // response //
             /////////////////
             $responce['itemsToDelete'] = array_values($loaded_items);
             // $responce['query'] = $page_query->query;
             $responce['order'] = $query->get('order', '');
             $responce['orderby'] = $query->get('orderby', 'date');
         }
         // main loop
         $responce['html'] = $html;
     }
     return $responce;
 }
Exemplo n.º 4
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.º 6
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;
    }
 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')) . presscore_masonry_container_data_atts() . '>';
     //////////////////////
     // Custom loop //
     //////////////////////
     $page_query = Presscore_Inc_Testimonials_Post_Type::get_template_query();
     if ($page_query->have_posts()) {
         while ($page_query->have_posts()) {
             $page_query->the_post();
             get_template_part('content', 'testimonials');
         }
         wp_reset_postdata();
     }
     // masonry container close
     echo '</div>';
     // fullwidth wrap close
     if ($config->get('full_width')) {
         echo '</div>';
     }
     /////////////////////
     // Pagination //