Example #1
0
<?php

/**
 * Recipe Single Rating
 *
 * @package   Recipe Hero
 * @author    Captain Theme <*****@*****.**>
 * @version   1.0.3
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
$recipe = new RH_Recipe(get_the_ID());
$count = $recipe->get_rating_count();
$average = $recipe->get_average_rating();
$link = is_archive() ? get_permalink(get_the_ID()) . '#reviews' : '#reviews';
if (get_option('recipe_hero_enable_review_rating') === 'no') {
    if (comments_open()) {
        ?>
	<span class="recipe-hero-recipe-rating">
		<span class="dashicons dashicons-testimonial"></span> <a href="<?php 
        echo $link;
        ?>
" rel="nofollow"><?php 
        printf(_n('%s Review', '%s Reviews', $count, 'recipe-hero'), '<span itemprop="ratingCount" class="count">' . $count . '</span>');
        ?>
</a>
	</span>
	<?php 
    }
 * @author    	Captain Theme <*****@*****.**>
 * @version 	1.0.2
 */
$recipe = new RH_Recipe(get_the_ID());
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
if (!comments_open()) {
    return;
}
?>
<div id="reviews">
	<div id="comments" class="comments-area">
		<h2><?php 
if (get_option('recipe_hero_enable_review_rating') === 'yes' && ($count = $recipe->get_rating_count())) {
    printf(_n('%s review for %s', '%s reviews for %s', $count, 'recipe-hero'), $count, get_the_title());
} else {
    _e('Reviews', 'recipe-hero');
}
?>
</h2>

		<?php 
// Use get_comments_number() to check as comments_template hasn't loaded yet
if ('0' !== get_comments_number()) {
    ?>

			<ol class="commentlist">
				<?php 
    wp_list_comments(apply_filters('recipe_hero_recipe_review_list_args', array('callback' => 'recipe_hero_comments')));