/** * Listing Rating * * @since Listify 1.0.0 * * @return void */ public function the_rating() { $rating = new Listify_Rating_Listing(array('object_id' => get_post()->ID)); ?> <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating" class="job_listing-rating-wrapper" title="<?php printf('%d Reviews', $rating->count()); ?> "> <span class="job_listing-rating-stars"> <?php echo $rating->stars(); ?> </span> <span class="job_listing-rating-average"> <span itemprop="ratingValue"><?php echo $rating->output(); ?> </span> </span> <span class="job_listing-rating-count"> <?php printf('<span itemprop="reviewCount">%d</span> Reviews', $rating->count()); ?> </span> </div> <?php }
public function listing_data($data) { global $post; /** Rating - can be replaced with other plugins */ $rating = new Listify_Rating_Listing(array('object_id' => $post->ID)); $data['rating'] = sprintf(_n('%d Star', '%d Stars', $rating->output(), 'listify'), $rating->output()); return $data; }