Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I tried using the AggregateRating and used the code below. The values of $aggregate_rating and $total_reviews is not empty, and tried printing its value.

Now I added the code inside my WordPress post, and checked the preview on Google's rich snippet testing tool. AggregateRating is not showing.

<div itemscope="" itemtype="http://schema.org/AutoRepair">
    <strong><span itemprop="name">GMD Auto Shop</span></strong>
    [php]
        echo "<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
        <span itemprop="ratingValue">". $aggregate_rating . " </span> stars for <span itemprop="reviewCount">" . 
        $total_reviews . "</span></div>reviews.";
    [/php]        
    <span itemprop="streetAddress">Kamagong Street, Lahug</span>
    <div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress"><span itemprop="addressLocality">Cebu City</span>,
        <span itemprop="addressRegion"> Cebu</span>
        <span itemprop="postalCode">6000</span>
    </div>
    Phone: <span itemprop="telephone">032-417-4700</span>
    <div itemprop="geo" itemscope="" itemtype="http://schema.org/GeoCoordinates">Latitude: 40 deg 44 min 54.36 sec N
        Longitude: 123° 54.037'
        <meta itemprop="latitude" content="40.75" />
        <meta itemprop="longitude" content="54.98" />
    </div>
</div>
share|improve this question
    
Although http://schema.org/AutoRepair is a valid itemtype, in my experience any itemtype other than http://schema.org/Product does not show in the rich snippet testing tool. I find this frustrating as it means listing organisations as products. Although the above will get your rating shown in the snippets tool, I am interested to know if there is a solution that allows us to use the correct itemtype and see a rating in the rich snippets tool. –  Richard Parnaby-King Dec 12 '13 at 18:02
    
Your PHP code looks invalid. [php] should be <?php>. Also, you are using a double quoted string with double quotes inside it. There is no way that what you pasted in would print out valid markup that Google's tool could understand. –  Stephen Ostermiller Dec 13 '13 at 11:59
1  
I am using a plugin in wordpress that enables the php code inserted inside a post. [php] is like a short code. –  rahstame Dec 15 '13 at 6:03

1 Answer 1

@lordzden your PHP as Stephen points out is invalid. Your echo should look like

<?php
$aggregate_rating = '6.5';
$total_reviews = '24';

echo '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span itemprop="ratingValue">'. $aggregate_rating .'</span> stars for <span itemprop="reviewCount">'. $total_reviews . '</span></div>reviews';
?>
share|improve this answer
    
He/she is using shortcode... in WordPress –  bybe Jan 3 at 11:23
    
@bybe I know that they are using a shortcode plugin. They seem to be a little familiar with PHP enough to know that my open and close tags would need to be replaced with their shortcode. –  Anagio Jan 3 at 20:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.