• Resolved davidebabylonia

    (@davidebabylonia)


    I have some of my post marked up with https://schema.org/recipe, 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="https://schema.org/Recipe">
    [printfriendly]
    <span style="text-align: center;"><a href="https://www.cookingwithpeachy.com/wordpress/wp-content/uploads/2014/03/mama-sitas-java-pork-bbq-and-tocino-liempo.jpg" 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="https://www.cookingwithpeachy.com/wordpress/wp-content/uploads/2014/04/mama-sitas-java-pork-bbq-and-tocino-liempo-480x391.jpg" 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="https://schema.org/NutritionInformation"><span>Calories per serving: <span itemprop="calories">535 kcal</span></span></span>
    <p><strong>Ingredients:</strong></p>
    <ul>
    <li><span itemprop="ingredients"><strong><a title="Java Marinade Sauce" href="https://www.msita.com/sauces_marinade_seasoning.htm" 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>
    </ul>
    <p><strong>Directions:</strong></p>
    <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>
    </ol>
    [adsense]
    [youtube]HMP2CCxEv1k[/youtube]
    </div>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Igor Yavych

    (@flyerua)

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

    Thread Starter davidebabylonia

    (@davidebabylonia)

    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:

    example:

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

    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?

    Thread Starter davidebabylonia

    (@davidebabylonia)

    Any news about this question?

    Thread Starter davidebabylonia

    (@davidebabylonia)

    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="https://schema.org/Product"><meta itemprop="name" content="'.$post->post_title.'"><div class="spr_hidden" itemprop="aggregateRating" itemscope="" itemtype="https://schema.org/AggregateRating"><meta itemprop="bestRating" content="'.$options['scale'].'"><meta itemprop="ratingValue" content="'.$rate.'"><meta itemprop="ratingCount" content="'.$votes.'"></div></div>';
            }

    to:

    {
    
                $aggregated='<div class="spr_hidden" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating"><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.