Tagged: schema
I would like to add the following code to the <head> section of just my /reviews page
<script type=”application/ld+json”>
{ “@context”: “http://schema.org”,
“@type”: “Product”,
“name”: “Hypnotherapy”,
“aggregateRating”:
{“@type”: “AggregateRating”,
“ratingValue”: “4.7”,
“reviewCount”: “54”
}
}
</script>
I am running the Enfold child theme and am unsure where I should put the code and wanted some help please
Hey hypnorich,
If you want to place it on one page only then we would need the id of the page. If you don’t know how to find that then please post admin login details in private.
Best regards,
Rikard
page ID is 9162
Hi,
Thanks, please try the following at the end of your functions.php file:
function hypnorich_add_custom_code() {
if(is_page(9162)) { ?>
<script type=”application/ld+json”>
{ “@context”: “http://schema.org”,
“@type”: “Product”,
“name”: “Hypnotherapy”,
“aggregateRating”:
{“@type”: “AggregateRating”,
“ratingValue”: “4.7”,
“reviewCount”: “54”
}
}
</script>
<?php
}
}
add_action('wp_head', 'hypnorich_add_custom_code');
Best regards,
Rikard
I have put the code in where you said but the structured data testing tool is not showing it in its report on my /reviews page. It isn’t showing any errors either though
Correction….it os showing it as a sub section of a different element. Looks like we are all good. Thanks for your support
Hi,
Glad we could help!
We really appreciate it if you rate our theme on themeforest https://themeforest.net/downloads
To know more about enfold features please check – http://kriesi.at/documentation/enfold/
Thank you for using Enfold :)
Best regards,
Vinay