I want to display the “ratingValue” and “ratingCount” values generated by the KK Star Ratings plugin (Github).
I made a JSON-LD SoftwareAplication and here is the code I use in function.php:
add_action('wp_head', 'add_jsonld_head', 1);
function add_jsonld_head() {
if ( is_single() ) {
?>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "SoftwareApplication",
"@id": "<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>",
"softwareVersion": "<?php the_field('versi_terbaru'); ?>",
"operatingSystem": "Windows",
"applicationCategory": "<?php the_field('kategori'); ?>",
"dateModified": "<?php the_modified_time('c'); ?>",
"name": "<?php the_title(); ?>",
"aggregateRating": {
"@type": "AggregateRating",
"name": "<?php the_title(); ?>",
"ratingValue": "",
"ratingCount": "",
"bestRating": "5",
},
"publisher": {
"@type": "organization",
"name": "<?php the_title(); ?>"
},
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "IDR"
},
"image":{
"@type": "ImageObject",
"url": "<?php the_post_thumbnail_url(); ?>",
"width": "100",
"height": "100"
}
}
</script>
<?php
}
}
How do I get the ratingValue and ratingCount values from KK Star Ratings?
I have played around with this plugins but sadly my coding skills are not that good so I couldn’t figure out how to modify it. I would really appreciate any help I can get on this.
Go to Source
Author: Renomu Reza