Search code examples
imagewordpresswordpress-jetpack

Adding rating feature to Jetpack Carousel


I'm using jet-pack carousel in my gallery website and i want to add image rating capabilities. I have the "wp-postratings" plugin running on the rest of my site.

I'm assuming that i could add this to individual images as wp treats each image as a post, if so where would i find the template i should add this code to?

All the plugin requires is that i add one line of php to the page/image but i can't figure out where it shoud go as the code for carousel seems to be entirely js and php generated.


Solution

  • in a js file jetPack_meet_wpPostRating.js copy this code (place the file in the js folder of your theme):

    in the functions.php file of your theme put this code:


    • NOTE
    • after installing the above scripts make sure to delete the browser cache before test.
    • tested with latest wordpress, jetpack and wp-postrating versions.
    • this will also work with multiple gallery in the same page.
    • does not need to put any extra [ratings] shortcode anyware.
    • the bounty for this answer is too low... ;)

    • FIX
    • Fixed bugs added some check and debug to consol.log...