I’ve set up article rating on my website and want the star rating for each article to show under the title on the front page. I’ve been trying to use the wp_gdsr_render_review() function to add the results to my theme with no success. The results appear fine if I use the GD star rating widget so they are definitely being stored okay. Is there a known problem with wp_gdsr_render_review()? I created the function using the build tool.
Here is the exact code I used ($meta_desc supplies each post ID):
wp_gdsr_render_review($meta_desc, 16, 'oxygen', 16);
I’m just working on this now and I have managed to get it working. It tends to print out the id though in my HTML.
In the page that you want to edit I put the following:
<? wp_gdsr_render_review(the_ID(), 16, 'noses', 12); ?>
‘noses’ is just a custom graphic set that I created.
You probably already know by just in case, don’t confuse a rating with a review either. The values inside a post refer to it’s review value. That will influence how many stars are displayed for the article.
Looking into the legacy.php file, there is a check for when the id == 0. It will just get the post id automatically. Perhaps leaving at 0 might solve your issue?
Mine still doesn’t work, although if that code works for you then it suggests that the problem is with my code rather than the plugin which narrows it down a little.
I tried leaving the ID at 0 with no success. Do you have to vote on a certain number before they appear? I looked through the settings to make sure this wasn’t the case and added more than 10 votes to one and it didn’t help.
The reason your code prints out the ID is that you’ve used the_ID() which echos the value. If you use get_the_ID() instead it should work without printing it.
Right, I’ve just deactivated every plugin except GD star rating and switched back to the original Twentyeleven theme and its still not working!
Just to be clear the stars do appear but it shows 0 for every article. I use the wp_gdsr_render_rating_results() function on the front page as well but this shows all of the star ratings correctly.
I am using a customised version of the Twentyeleven theme.
Which version of the plugin are you using? Oh and I forgot to thank you for replying!
Okay it turns out that the functionality of wp_gdsr_render_review() can be mimicked using another function.
I used the wp_gdsr_render_article() function to display the review as read only so users couldn’t rate it on the front page, just on the post itself.
Great plugin but the functionality can be very confusing!!
- The topic ‘[Plugin: GD Star Rating] wp_gdsr_render_review not working’ is closed to new replies.