Exemple #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 
    }
Exemple #2
0
<?php

/**
 * Recipe Photo Gallery Thumbnails
 *
 * @package   Recipe Hero
 * @author    Captain Theme <*****@*****.**>
 * @version   1.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $post;
$recipe = new RH_Recipe($post->ID);
$attachment_ids = $recipe->get_gallery_attachment_ids();
if ($attachment_ids) {
    ?>
	<div class="thumbnails"><?php 
    $loop = 0;
    $columns = apply_filters('recipe_hero_recipe_thumbnails_columns', 5);
    foreach ($attachment_ids as $attachment_id) {
        $classes = array('recipe-gallery');
        if ($loop == 0 || $loop % $columns == 0) {
            $classes[] = 'first';
        }
        if (($loop + 1) % $columns == 0) {
            $classes[] = 'last';
        }
        $classes[] = 'columns-' . $columns;
        $image_link = wp_get_attachment_url($attachment_id);
Exemple #3
0
<?php

/**
 * Recipe Single Photo
 *
 * @package   Recipe Hero
 * @author    Captain Theme <*****@*****.**>
 * @version   1.0.5
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $post;
$recipe = new RH_Recipe($post->ID);
$photo = get_the_post_thumbnail($post->ID, 'recipe_single', array('itemprop' => 'image'));
$thumb = get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'recipe-schema-thumb', 'itemprop' => 'image'));
?>

<div class="images">

	<?php 
if (has_post_thumbnail()) {
    $image_title = esc_attr(get_the_title(get_post_thumbnail_id()));
    $image_link = wp_get_attachment_url(get_post_thumbnail_id());
    $image = get_the_post_thumbnail($post->ID, apply_filters('single_recipe_large_thumbnail_size', 'recipe_single'), array('title' => $image_title));
    $attachment_count = count($recipe->get_gallery_attachment_ids());
    $gallery = 'recipe-gallery';
    echo apply_filters('recipe_hero_single_recipe_image_html', sprintf('<a href="%s" itemprop="image" class="recipe-hero-main-image zoom ' . $gallery . '" title="%s">%s</a>', $image_link, $image_title, $image), $post->ID);
    echo $thumb;
    // Don't Remove (Google Meta Data)
<?php

/**
 * Recipe Single Reviews
 *
 * @package   	Recipe Hero
 * @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
Exemple #5
0
<?php

/**
 * Archive / loop display rating
 *
 * @package   	Recipe Hero
 * @author    	Captain Theme <*****@*****.**>
 * @version 	1.0.2
 */
if (!defined('ABSPATH')) {
    exit;
    // Exit if accessed directly
}
$recipe = new RH_Recipe($post->ID);
if (get_option('recipe_hero_enable_review_rating') === 'no') {
    return;
}
?>

<?php 
if ($rating_html = $recipe->get_rating_html()) {
    ?>
	<?php 
    echo $rating_html;
}