Adding a star rating next to your listing on Google Search Results can significantly enhance your visibility and click-through rates. This is achieved using schema markup, which helps search engines understand your content better. Below, we’ll guide you on how to implement both Review Schema and Aggregate Rating Schema for your WordPress site. We’ll also provide the necessary code snippets to add to your functions.php file, including optional enhancements with your company information.
Step 1: Adding Review Schema
Review Schema allows you to showcase reviews directly in your search result snippet. Here’s a basic example of how to include three reviews, along with company information for added credibility:
Code for functions.php
add_action('wp_head', 'add_review_and_company_schema');
function add_review_and_company_schema() {
if (is_page('your-page-slug')) { // Replace 'your-page-slug' with the actual slug of your page
echo '<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Review",
"itemReviewed": {
"@type": "Organization",
"name": "Your Company Name", // Replace with your company name
"url": "https://www.yourwebsite.com", // Replace with your website URL
"logo": "https://www.yourwebsite.com/logo.png", // Replace with your logo URL
"address": {
"@type": "PostalAddress",
"streetAddress": "123 Example Street", // Replace with your address
"addressLocality": "Your City", // Replace with your city
"addressRegion": "Your State/Region", // Replace with your state/region
"postalCode": "12345", // Replace with your postal code
"addressCountry": "Your Country" // Replace with your country
},
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1234567890", // Replace with your phone number
"email": "info@yourwebsite.com" // Replace with your email
}
},
"review": [
{
"@type": "Review",
"author": "John Doe",
"reviewBody": "Great service! Highly recommended.",
"reviewRating": {
"@type": "Rating",
"ratingValue": "5",
"bestRating": "5"
}
},
{
"@type": "Review",
"author": "Jane Smith",
"reviewBody": "Excellent quality and customer support.",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4.5",
"bestRating": "5"
}
},
{
"@type": "Review",
"author": "Chris Johnson",
"reviewBody": "Satisfied with the overall experience.",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4",
"bestRating": "5"
}
}
]
}
</script>';
}
}
Step 2: Adding More Reviews
To add more reviews, simply duplicate the review block within the "review": [] array and replace the details with your reviewers’ names, review text, and ratings.
Step 3: Adding Aggregate Rating Schema
Aggregate Rating Schema is a summary of all reviews, providing an overall rating for your product or service. Here’s how to implement it:
Code for functions.php
add_action('wp_head', 'add_aggregate_rating_schema');
function add_aggregate_rating_schema() {
if (is_page('your-page-slug')) { // Replace 'your-page-slug' with the actual slug of your page
echo '<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "AggregateRating",
"itemReviewed": {
"@type": "Thing",
"name": "Your Product or Service Name" // Replace with your product/service name
},
"ratingValue": "4.5", // Replace with your average rating
"reviewCount": "3" // Replace with the number of reviews
}
</script>';
}
}
Step 4: Customising the Code
- Replace
your-page-slugwith the slug of the page where you want the schema to appear. - Edit
Your Product or Service NameorYour Company Nameto reflect your product or company. - Adjust
ratingValueandreviewCountin the Aggregate Rating Schema based on your actual data. - Add your company’s address, telephone, email, and logo in the
itemReviewedfield if applicable.
Step 5: Testing Your Schema
Use Google’s Rich Results Test to verify that your schema markup is correctly implemented and eligible for star ratings in search results.
Final Thoughts
Adding star ratings and company details to your Google listing can make your website stand out. By using structured data, you provide search engines with clear, detailed information about your business, improving your website’s SEO. This can lead to higher rankings in search results, increased trust from potential customers, and ultimately, more traffic to your site. By customising and testing your schema markup, you’re taking a significant step toward making your website more competitive in today’s digital landscape.
For more insights and tips, visit our BSolve IT Blog.
