function outputTestimonialsCycle($atts) { //load shortcode attributes into an array extract(shortcode_atts(array('testimonials_link' => get_option('testimonials_link'), 'show_title' => 0, 'count' => -1, 'transition' => 'scrollHorz', 'show_thumbs' => '', 'timer' => '2000', 'container' => false, 'use_excerpt' => false, 'auto_height' => false, 'category' => '', 'body_class' => 'testimonial_body', 'author_class' => 'testimonial_author', 'random' => '', 'orderby' => 'date', 'order' => 'ASC', 'pager' => false, 'show_pager_icons' => false, 'show_rating' => false, 'testimonials_per_slide' => 1, 'theme' => '', 'show_date' => false, 'show_other' => false, 'pause_on_hover' => false, 'prev_next' => false, 'width' => false, 'paused' => false), $atts)); $show_thumbs = $show_thumbs == '' ? get_option('testimonials_image') : $show_thumbs; if (!is_numeric($count)) { $count = -1; } ob_start(); $i = 0; if (!isValidKey() && !in_array($transition, array('fadeOut', 'fade', 'scrollHorz'))) { $transition = 'fadeout'; } //use random WP query to be sure we aren't just randomly sorting a chronologically queried set of testimonials //this prevents us from just randomly ordering the same 5 testimonials constantly! if ($random) { $orderby = "rand"; } //determine if autoheight is set to container or to calculate //not sure why i did this so backwards to begin with! oh well... if ($container) { $container = "container"; } if ($auto_height == "calc") { $container = "calc"; } else { if ($auto_height == "container") { $container = "container"; } } ?> <div class="cycle-slideshow" data-cycle-fx="<?php echo $transition; ?> " data-cycle-timeout="<?php echo $timer; ?> " data-cycle-slides="> div.testimonial_slide" <?php if ($container) { ?> data-cycle-auto-height="<?php echo $container; ?> " <?php } ?> <?php if ($random) { ?> data-cycle-random="true" <?php } ?> <?php if ($pause_on_hover) { ?> data-cycle-pause-on-hover="true" <?php } ?> <?php if ($paused) { ?> data-cycle-paused="true" <?php } ?> <?php if ($prev_next) { ?> data-cycle-prev=".easy-t-cycle-prev" data-cycle-next=".easy-t-cycle-next" <?php } ?> > <?php $counter = 0; //load testimonials into an array $loop = new WP_Query(array('post_type' => 'testimonial', 'posts_per_page' => $count, 'orderby' => $orderby, 'order' => $order, 'easy-testimonial-category' => $category)); while ($loop->have_posts()) { $loop->the_post(); if ($counter == 0) { $testimonial_display = ''; } else { $testimonial_display = 'style="display:none;"'; } if ($counter % $testimonials_per_slide == 0) { ?> <div <?php echo $testimonial_display; ?> class="testimonial_slide"><?php } $counter++; $postid = get_the_ID(); $testimonial['date'] = get_the_date('M. j, Y'); //if nothing is set for the short content, use the long content if ($use_excerpt) { $testimonial['content'] = get_the_excerpt(); } else { $testimonial['content'] = get_the_content(); } //load rating //if set, append english text to it $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true); $testimonial['num_stars'] = ''; //reset num stars (Thanks Steve@IntegrityConsultants!) if (strlen($testimonial['rating']) > 0) { $testimonial['num_stars'] = $testimonial['rating']; $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>'; //$testimonial['rating'] = '<span class="easy_t_ratings">' . $testimonial['rating'] . '/5 Stars.</span>'; } //if nothing is set for the short content, use the long content if (strlen($testimonial['content']) < 2) { $temp_post_content = get_post($postid); $testimonial['content'] = $temp_post_content->post_excerpt; if ($use_excerpt) { if ($testimonial['content'] == '') { $testimonial['content'] = wp_trim_excerpt($temp_post_content->post_content); } } else { $testimonial['content'] = $temp_post_content->post_content; } } if (strlen($show_rating) > 2) { if ($show_rating == "before") { $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content']; } if ($show_rating == "after") { $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating']; } } if ($show_thumbs) { $testimonial['image'] = build_testimonial_image($postid); } $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true); $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true); $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true); echo build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width); if ($counter % $testimonials_per_slide == 0) { ?> </div><?php } } wp_reset_query(); //display pager icons if ($pager || $show_pager_icons) { ?> <div class="cycle-pager"></div><?php } ?> </div> <?php //display previous and next buttons //do it after the closing div so it is outside of the slideshow container if ($prev_next) { ?> <div class="cycle-prev easy-t-cycle-prev"><< Prev </div> <div class="cycle-next easy-t-cycle-next">Next >></div><?php } $content = ob_get_contents(); ob_end_clean(); return apply_filters('easy_t_testimonials_cyle_html', $content); }
function easy_t_get_single_testimonial_html($postid, $atts, $is_single = false) { //for use in the filter $atts['is_single'] = $is_single; //if this is being loaded from the single post view //then we already have the post data setup (we are in The Loop) //so skip this step if (!$is_single) { global $post; $post = get_post($postid, OBJECT); setup_postdata($post); } extract($atts); ob_start(); $testimonial['date'] = get_the_date('M. j, Y'); if ($use_excerpt) { $testimonial['content'] = get_the_excerpt(); } else { $testimonial['content'] = get_the_content(); } //load rating //if set, append english text to it $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true); $testimonial['num_stars'] = ''; //reset num stars (Thanks Steve@IntegrityConsultants!) if (strlen($testimonial['rating']) > 0) { $rating_css = easy_testimonials_build_typography_css('easy_t_rating_'); $testimonial['num_stars'] = $testimonial['rating']; $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" style="' . $rating_css . '"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue" >' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>'; } //if nothing is set for the short content, use the long content if (strlen($testimonial['content']) < 2) { //$temp_post_content = get_post($postid); $testimonial['content'] = $post->post_excerpt; if ($use_excerpt) { if ($testimonial['content'] == '') { $testimonial['content'] = wp_trim_excerpt($post->post_content); } } else { $testimonial['content'] = $post->post_content; } } if (strlen($show_rating) > 2) { if ($show_rating == "before") { $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content']; } if ($show_rating == "after") { $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating']; } } if ($show_thumbs) { $testimonial['image'] = build_testimonial_image($postid); } $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true); $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true); $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true); build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width, $is_single); wp_reset_postdata(); $content = ob_get_contents(); ob_end_clean(); return apply_filters('easy_t_get_single_testimonial_html', $content, $testimonial, $atts, $postid); }
function easy_t_get_single_testimonial_html($postid, $atts) { global $post; $post = get_post($postid, OBJECT); setup_postdata($post); extract($atts); ob_start(); $testimonial['date'] = get_the_date('M. j, Y'); if ($use_excerpt) { $testimonial['content'] = get_the_excerpt(); } else { $testimonial['content'] = get_the_content(); } //load rating //if set, append english text to it $testimonial['rating'] = get_post_meta($postid, '_ikcf_rating', true); $testimonial['num_stars'] = ''; //reset num stars (Thanks Steve@IntegrityConsultants!) if (strlen($testimonial['rating']) > 0) { $testimonial['num_stars'] = $testimonial['rating']; $testimonial['rating'] = '<p class="easy_t_ratings" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"><meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">' . $testimonial['rating'] . '</span>/<span itemprop="bestRating">5</span> Stars.</p>'; //$testimonial['rating'] = '<span class="easy_t_ratings">' . $testimonial['rating'] . '/5 Stars.</span>'; } //if nothing is set for the short content, use the long content if (strlen($testimonial['content']) < 2) { //$temp_post_content = get_post($postid); $testimonial['content'] = $post->post_excerpt; if ($use_excerpt) { if ($testimonial['content'] == '') { $testimonial['content'] = wp_trim_excerpt($post->post_content); } } else { $testimonial['content'] = $post->post_content; } } if (strlen($show_rating) > 2) { if ($show_rating == "before") { $testimonial['content'] = $testimonial['rating'] . ' ' . $testimonial['content']; } if ($show_rating == "after") { $testimonial['content'] = $testimonial['content'] . ' ' . $testimonial['rating']; } } if ($show_thumbs) { $testimonial['image'] = build_testimonial_image($postid); } $testimonial['client'] = get_post_meta($postid, '_ikcf_client', true); $testimonial['position'] = get_post_meta($postid, '_ikcf_position', true); $testimonial['other'] = get_post_meta($postid, '_ikcf_other', true); build_single_testimonial($testimonial, $show_thumbs, $show_title, $postid, $author_class, $body_class, $testimonials_link, $theme, $show_date, $show_rating, $show_other, $width); wp_reset_postdata(); $content = ob_get_contents(); ob_end_clean(); return $content; }