Support » Plugin: WP-PostRatings » how add data to ld+json format

  • Resolved p47ri0t

    (@p47ri0t)


    hi man thank you for great plugin
    how we can add ld+json like :

    
    <script type="application/ld+json">
     "aggregateRating": {
    				"@type": "AggregateRating",
    				"ratingValue": "4.34375",
    				"reviewCount": "32"
    			  },
    			"review": {
    			"@type": "Review",
    			"reviewRating": {
    			  "@type": "Rating",
    			  "ratingValue": "4.5"
    			},
    </script>
    
    • This topic was modified 8 months ago by  p47ri0t.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Xaibi Aslam

    (@lahorimela)

    I am also looking for this thing, i want to add in ld+json…

    Plugin Author Lester Chan

    (@gamerz)

    Note that I don’t provide support outside the plugin scope.

    You can try something like that within your WordPress loop. If you can’t get it to work, you might need to hire a dev.

    <script type="application/ld+json">
    "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "<?php echo get_post_meta( get_the_ID(), 'ratings_average' ); ?>",
    "reviewCount": "<?php echo get_post_meta( get_the_ID(), 'ratings_users' ); ?>"
    },
    "review": {
    "@type": "Review",
    "reviewRating": {
    "@type": "Rating",
    "ratingValue": "<?php echo get_post_meta( get_the_ID(), 'ratings_users' ); ?>"
    },
    </script>

    p47ri0t

    (@p47ri0t)

    my 5 star for you and your great plugin star for wordpress

    Hello Lester Chan,

    I have resuolt: Array 🙁

    Plugin Author Lester Chan

    (@gamerz)

    Ah sorry

    
    <script type="application/ld+json">
    "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "<?php echo get_post_meta( get_the_ID(), 'ratings_average', true ); ?>",
    "reviewCount": "<?php echo get_post_meta( get_the_ID(), 'ratings_users', true ); ?>"
    },
    "review": {
    "@type": "Review",
    "reviewRating": {
    "@type": "Rating",
    "ratingValue": "<?php echo get_post_meta( get_the_ID(), 'ratings_users',true ); ?>"
    },
    </script>
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how add data to ld+json format’ is closed to new replies.