Support » Plugin: Simple Rating » How to make it work with recipe markup?

  • Resolved davidebabylonia


    I have some of my post marked up with, I can see the correct snippet with i.e. preparation time and calories.

    When I activate your plugin, I loose all these info in behalf of the star rating.

    How can I make them work together?

    Please see this post

    I need to nest the aggregate rating into the post within the recipe schema, but without use static code, the ratings should update everytime some user rate a post

    Can you help?

    (here the post markup)

    <div style="width:96%; margin:0px auto;" itemscope itemtype="">
    <span style="text-align: center;"><a href="" target="_blank"><img class="size-full aligncenter wp-image-15350" title="Mama Sita's Java Pork BBQ and Tocino Liempo 480x391" alt="Mama Sita's Java Pork BBQ and Tocino Liempo 480x391" itemprop="image" src="" width="480" height="391" /></a></span>
    [here should be placed the aggregateRating code]
    <p>Rate <span itemprop="name">Mama Sita's Java Pork BBQ and Tocino Liempo</span></p>
    <p style="text-align: justify;"><span itemprop="description"><em>"Java pork BBQ is one of the several method for marinating the meat before grilling, we used a ready marinade sauce from Mama Sita's brand".</em></span></p>
    <span>Difficulty: <span style="font-size: medium;"><span style="color: #32cd32;">★</span></span></span>
    <span>Preparation time: <meta itemprop="prepTime" content="PT30M"/>30 min</span>
    <span>Cooking time: <meta itemprop="cookTime" content="PT30M"/>30 min</span>
    <span>Servings: <span itemprop="recipeYield">6</span></span>
    <span itemprop="nutrition" itemscope itemtype=""><span>Calories per serving: <span itemprop="calories">535 kcal</span></span></span>
    <li><span itemprop="ingredients"><strong><a title="Java Marinade Sauce" href="" target="_blank">Mama Sita's Java BBQ Marinade</a> - 1 bottle</strong></span></li>
    <li><span itemprop="ingredients"><strong>Mama Sita's Tocino Mix - 1 pouch</strong></span></li>
    <li><span itemprop="ingredients"><strong>Pork sirloin - 500 g (1.10 lb.)</strong></span></li>
    <li><span itemprop="ingredients"><strong>Pork liempo (belly) - 500 g (1.10 lb.)</strong></span></li>
    <ol style="text-align: justify;">
    <li><span itemprop="recipeInstructions">In a large bowl, cut the sirloin into bite-sized.</span></li>
    <li><span itemprop="recipeInstructions">Add the bottle of Mama Sita's BBQ Marinade and mix well.</span></li>
    <li><span itemprop="recipeInstructions">Allow marinate for 30 minutes, overnight for best result.</span></li>
    <li><span itemprop="recipeInstructions">Cut the pork liempo into stripes and add the Mama Sita's Tocino Mix.</span></li>
    <li><span itemprop="recipeInstructions">Allow marinate for 30 minutes or overnight for best result.</span></li>
    <li><span itemprop="recipeInstructions">Char grill the Java pork well done and serve hot.</span></li>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Igor Yavych


    I’m not sure why, I’m not actually sure both can be there at the same time.

    Ya it can, if I code it inside with static rating the snippet show correctly, just I don’t know how to fetch data from the plugin instead:


    <div itemprop="aggregateRating" itemscope itemtype="">
    <span itemprop="ratingValue">[rating given]</span>/
    <span itemprop="bestRating">[highest possible rating]</span> stars from
    <span itemprop="reviewCount">[total number of reviews]</span> users.

    If i insert this code in the post and replace the data within […] with numbers, then it shows fine.

    My question is, how to replace […] with data dinamically fetched from your plugin for the actual post?

    Any news about this question?

    In the meantime I have solved by myself, I used a plugin to execute php code into posts and insert the recommended function:

    <?php if(function_exists('spr_show_rating')){echo spr_show_rating();}?>

    Then I modified the code of rating.php from:

                $aggregated='<div class="spr_hidden" itemscope="" itemtype=""><meta itemprop="name" content="'.$post->post_title.'"><div class="spr_hidden" itemprop="aggregateRating" itemscope="" itemtype=""><meta itemprop="bestRating" content="'.$options['scale'].'"><meta itemprop="ratingValue" content="'.$rate.'"><meta itemprop="ratingCount" content="'.$votes.'"></div></div>';


                $aggregated='<div class="spr_hidden" itemprop="aggregateRating" itemscope itemtype=""><meta itemprop="bestRating" content="'.$options['scale'].'"><meta itemprop="ratingValue" content="'.$rate.'"><meta itemprop="ratingCount" content="'.$votes.'"></div>';

    in order to render the whole snippet inside the post as a property under recipe markup.

    Now the rating became an item under recipe and it won’t replace the other data within recipe

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to make it work with recipe markup?’ is closed to new replies.