public function widget($args, $instance) { if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } ob_start(); extract($args); $carousel_rn = rand(10, 100); $title = apply_filters('widget_title', empty($instance['title']) ? __('Testimonials', 'pinnacle') : $instance['title'], $instance, $this->id_base); if (empty($instance['number']) || !($number = absint($instance['number']))) { $number = 10; } if (empty($instance['wordcount']) || !($wordcount = absint($instance['wordcount']))) { $wordcount = 25; } if (isset($instance['orderby'])) { $testorder = $instance['orderby']; } else { $testorder = 'rand'; } if (isset($instance['columns'])) { $columns = $instance['columns']; } else { $columns = '1'; } if (!empty($instance['link'])) { $link = $instance['link']; } else { $link = false; } if (!empty($instance['linktext'])) { $linktext = $instance['linktext']; } else { $linktext = ''; } if (!empty($instance['pagelink'])) { $pagelink = $instance['pagelink']; } else { $pagelink = ''; } if (!empty($instance['speed'])) { $speed = $instance['speed']; } else { $speed = '11000'; } if (!empty($instance['test_bg_color'])) { $test_bg_color = $instance['test_bg_color']; } else { $test_bg_color = '#ffffff'; } if (!empty($instance['test_color'])) { $test_color = 'color:' . $instance['test_color']; } else { $test_color = 'color: #444444'; } if (!empty($instance['test_title_color'])) { $test_title_color = 'color:' . $instance['test_title_color']; $test_title_color_bg = 'background-color:' . $instance['test_title_color']; } else { $test_title_color = 'color: #444444'; $test_title_color_bg = 'background-color:#4444;'; } if (!empty($instance['test_bg_opacity'])) { $test_bg_opacity = $instance['test_bg_opacity']; } else { $test_bg_opacity = '1'; } if (empty($instance['scroll']) || $instance['scroll'] == 1) { $scroll = 'items:1,'; } else { $scroll = ''; } $bg_color_rgb = kt_hex2rgb($test_bg_color); $bg_color = 'background: rgba(' . $bg_color_rgb[0] . ', ' . $bg_color_rgb[1] . ', ' . $bg_color_rgb[2] . ', ' . $test_bg_opacity . ');'; $border_color = 'border-top-color: rgba(' . $bg_color_rgb[0] . ', ' . $bg_color_rgb[1] . ', ' . $bg_color_rgb[2] . ', ' . $test_bg_opacity . ');'; if ($columns == '2') { $itemsize = 'tcol-lg-6 tcol-md-6 tcol-sm-6 tcol-xs-12 tcol-ss-12'; $slidewidth = 560; $slideheight = 560; $md = 2; $sm = 2; $xs = 1; $ss = 1; } else { if ($columns == '1') { $itemsize = 'tcol-lg-12 tcol-md-12 tcol-sm-12 tcol-xs-12 tcol-ss-12'; $slidewidth = 560; $slideheight = 560; $md = 1; $sm = 1; $xs = 1; $ss = 1; } else { if ($columns == '3') { $itemsize = 'tcol-lg-4 tcol-md-4 tcol-sm-4 tcol-xs-6 tcol-ss-12'; $slidewidth = 366; $slideheight = 366; $md = 3; $sm = 3; $xs = 2; $ss = 1; } else { if ($columns == '6') { $itemsize = 'tcol-lg-2 tcol-md-2 tcol-sm-3 tcol-xs-4 tcol-ss-6'; $slidewidth = 240; $slideheight = 240; $md = 6; $sm = 4; $xs = 3; $ss = 2; } else { if ($columns == '5') { $itemsize = 'tcol-lg-25 tcol-md-25 tcol-sm-3 tcol-xs-4 tcol-ss-6'; $slidewidth = 240; $slideheight = 240; $md = 5; $sm = 4; $xs = 3; $ss = 2; } else { $itemsize = 'tcol-lg-3 tcol-md-3 tcol-sm-4 tcol-xs-6 tcol-ss-12'; $slidewidth = 269; $slideheight = 269; $md = 4; $sm = 3; $xs = 2; $ss = 1; } } } } } $widget_title_style = '<style type="text/css">#testimonial-c-case-' . $carousel_rn . ' .widget-title {' . $test_title_color . '} #testimonial-c-case-' . $carousel_rn . ' .widget-title:after {' . $test_title_color_bg . '}</style>'; $r = new WP_Query(apply_filters('widget_posts_args', array('post_type' => 'testimonial', 'testimonial-group' => $instance['thecat'], 'no_found_rows' => true, 'posts_per_page' => $number, 'orderby' => $testorder, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($r->have_posts()) { ?> <?php echo $before_widget; ?> <?php echo $widget_title_style; ?> <div id="testimonial-c-case-<?php echo $carousel_rn; ?> "> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <div class="fredcarousel"> <div id="carouselcontainer-<?php echo $carousel_rn; ?> " class="rowtight kt-testimonail-carousel"> <div id="testimonial-carousel-<?php echo $carousel_rn; ?> " class="kad-testimonial-carousel"> <?php while ($r->have_posts()) { $r->the_post(); ?> <div class="<?php echo $itemsize; ?> t_item"> <div class="grid_item testimonial_item all"> <div class="testimonialbox clearfix" style="<?php echo $bg_color; ?> <?php echo $test_color; ?> "> <?php global $post; ?> <?php echo esc_attr(strip_tags(pinnacle_content($wordcount))); ?> <?php if (isset($link) && $link == 'page') { if (!empty($pagelink)) { $thepagelink = $pagelink; } else { $thepagelink = get_the_permalink(); } echo '<a href="' . $thepagelink . '" class="kadtestimoniallink testpagelink">'; if (!empty($linktext)) { $thelinktext = $linktext; } else { $thelinktext = __('Read More', 'virtue'); } echo $thelinktext; echo '</a>'; } else { if (isset($link) && $link == 'post') { echo '<a href="' . get_the_permalink() . '" class="kadtestimoniallink">'; if (!empty($linktext)) { $thelinktext = $linktext; } else { $thelinktext = __('Read More', 'virtue'); } echo $thelinktext; echo '</a>'; } } ?> </div> <div class="testimonialbottom"> <div class="lipbg kad-arrow-down" style="<?php echo $border_color; ?> "></div> <p style="<?php echo $test_title_color; ?> "><strong><?php the_title(); ?> </strong> <?php $location = get_post_meta($post->ID, '_kad_testimonial_location', true); if ($location != '') { echo ' - ' . $location; } ?> </p> </div> <!--testimonial bottom --> </div> <!-- grid item --> </div> <!--itemsize --> <?php } ?> </div> </div> <div class="clearfix"></div> <a class="prev kt-icon-arrow-left test-prev" id="prevport-<?php echo $carousel_rn; ?> " style="<?php echo $bg_color; ?> <?php echo $test_color; ?> " href="#"></a> <a class="next kt-icon-arrow-right test-next" id="nextport-<?php echo $carousel_rn; ?> " style="<?php echo $bg_color; ?> <?php echo $test_color; ?> " href="#"></a> </div> <script type="text/javascript"> jQuery( window ).load(function () {var $wcontainer = jQuery('#carouselcontainer-<?php echo $carousel_rn; ?> '); var $container = jQuery('#testimonial-carousel-<?php echo $carousel_rn; ?> '); function ini_testCarousel() { $container.carouFredSel({scroll: { <?php echo $scroll; ?> easing: "swing", duration: 700, pauseOnHover : true}, auto: {play: true, timeoutDuration: <?php echo $speed; ?> },prev: '#prevport-<?php echo $carousel_rn; ?> ', next: '#nextport-<?php echo $carousel_rn; ?> ', pagination: false, swipe: true, items: {visible: null}}); } setWidths(); ini_testCarousel(); jQuery(window).on("debouncedresize", function( event ) { $container.trigger("destroy"); setWidths(); ini_testCarousel();}); $wcontainer.animate({'opacity' : 1}); function getUnitWidth() {var width; if(jQuery(window).width() <= 480) { width = $wcontainer.width() / <?php echo $ss; ?> ; } else if(jQuery(window).width() <= 768) { width = $wcontainer.width() / <?php echo $xs; ?> ; } else if(jQuery(window).width() <= 990) { width = $wcontainer.width() / <?php echo $sm; ?> ; } else { width = $wcontainer.width() / <?php echo $md; ?> ; } return width; } function setWidths() { var unitWidth = getUnitWidth() -1; $container.children().css({ width: unitWidth }); } }); </script> </div> <?php echo $after_widget; // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } }
?> " alt="<?php esc_attr(the_title()); ?> " class="" style="display: block; max-width:80px;"> </div> <?php $image = null; $thumbnailURL = null; ?> <?php } ?> <?php if ($limit_text) { echo esc_attr(strip_tags(pinnacle_content($wordcount))); } else { the_content(); } if ($postlink) { echo '<a href="' . get_the_permalink() . '" class="kadtestimoniallink">'; echo $thelinktext; echo '</a>'; } ?> </div> <div class="testimonialbottom"> <div class="lipbg kad-arrow-down"></div> <p><strong><?php the_title(); ?>
function kad_testimonial_shortcode_function($atts, $content) { extract(shortcode_atts(array('orderby' => 'menu_order', 'cat' => '', 'id' => rand(10, 100), 'columns' => '3', 'wordcount' => '25', 'offset' => null, 'isostyle' => 'masonry', 'postlink' => 'false', 'limit_text' => 'false', 'items' => '3'), $atts)); if ($orderby == 'menu_order') { $order = 'ASC'; } else { $order = 'DESC'; } if (empty($cat)) { $cat = ''; } if ($columns == '2') { $itemsize = 'tcol-md-6 tcol-sm-6 tcol-xs-12 tcol-ss-12'; } else { if ($columns == '1') { $itemsize = 'tcol-md-12 tcol-sm-12 tcol-xs-12 tcol-ss-12'; } else { if ($columns == '3') { $itemsize = 'tcol-md-4 tcol-sm-4 tcol-xs-6 tcol-ss-12'; } else { if ($columns == '6') { $itemsize = 'tcol-md-2 tcol-sm-3 tcol-xs-4 tcol-ss-6'; } else { if ($columns == '5') { $itemsize = 'tcol-md-25 tcol-sm-3 tcol-xs-4 tcol-ss-6'; } else { $itemsize = 'tcol-md-3 tcol-sm-4 tcol-xs-6 tcol-ss-12'; } } } } } global $pinnacle; if (isset($pinnacle['pinnacle_animate_in']) && $pinnacle['pinnacle_animate_in'] == 1) { $animate = 1; } else { $animate = 0; } ob_start(); ?> <div class="home-testimonial"> <div id="testimonialwrapper-<?php echo esc_attr($id); ?> " class="rowtight init-isotope" data-iso-selector=".t_item" data-iso-style="<?php echo esc_attr($isostyle); ?> " data-fade-in="<?php echo esc_attr($animate); ?> " data-iso-filter="false"> <?php $wp_query = null; $wp_query = new WP_Query(); $wp_query->query(array('orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post_type' => 'testimonial', 'testimonial-group' => $cat, 'posts_per_page' => $items)); $count = 0; if ($wp_query) { while ($wp_query->have_posts()) { $wp_query->the_post(); ?> <?php global $post; ?> <div class="<?php echo esc_attr($itemsize); ?> t_item"> <div class="grid_item testimonial_item kt_item_fade_in kad_testimonial_fade_in"> <div class="testimonialbox"> <?php if (has_post_thumbnail($post->ID)) { $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $thumbnailURL = $image_url[0]; $image = aq_resize($thumbnailURL, 80, 80, true); if (empty($image)) { $image = $thumbnailURL; } ?> <div class="alignleft testimonialimg"> <img src="<?php echo esc_url($image); ?> " alt="<?php esc_attr(the_title()); ?> " class="" style="display: block; max-width:80px;"> </div> <?php $image = null; $thumbnailURL = null; ?> <?php } ?> <?php if ($limit_text == "true") { echo esc_attr(strip_tags(pinnacle_content($wordcount))); } else { the_content(); } if ($postlink == 'true') { echo '<a href="' . get_the_permalink() . '" class="kadtestimoniallink">'; echo $thelinktext; echo '</a>'; } ?> </div> <div class="testimonialbottom"> <div class="lipbg kad-arrow-down"></div> <p><strong><?php the_title(); ?> </strong> <?php global $post; $location = get_post_meta($post->ID, '_kad_testimonial_location', true); if ($location != '') { echo ' - ' . $location; } ?> </p> </div> </div> </div> <?php } } else { ?> <li class="error-not-found"><?php _e('Sorry, no testimonial entries found.', 'pinnacle'); ?> </li> <?php } ?> </div> <!-- testimonialwrapper --> <?php $wp_query = null; wp_reset_query(); ?> </div><!-- /.home-testimonial --> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }