public static function get_review_count($testimonial) { self::$aggregate_data = apply_filters('tw_cache_get', self::$aggregate_data, 'tw_aggregate_data'); $testimonial_item = !empty($testimonial['testimonial_item']) ? $testimonial['testimonial_item'] : self::$aggregate_no_item; if (!isset(self::$aggregate_data[$testimonial_item]['count'])) { if (self::$aggregate_no_item != $testimonial_item) { // @codingStandardsIgnoreStart $query_args = array('post_type' => Testimonials_Widget::PT, 'posts_per_page' => -1, 'meta_query' => array('relation' => 'AND', array('key' => 'testimonials-widget-item', 'value' => $testimonial_item, 'compare' => 'LIKE'))); // @codingStandardsIgnoreEnd } else { // @codingStandardsIgnoreStart $query_args = array('post_type' => Testimonials_Widget::PT, 'posts_per_page' => -1, 'meta_query' => array('relation' => 'AND', array('key' => 'testimonials-widget-item', 'value' => '', 'compare' => 'LIKE'))); // @codingStandardsIgnoreEnd } $count = 0; $query = new WP_Query($query_args); while ($query->have_posts()) { $query->the_post(); $count++; } self::$aggregate_data[$testimonial_item]['count'] = $count; self::$aggregate_data = apply_filters('tw_cache_set', self::$aggregate_data, 'tw_aggregate_data'); } return self::$aggregate_data[$testimonial_item]['count']; }