• Resolved Nerina-01

    (@nerina-01)


    Hello,

    I have some trouble figuring out how to show the rating results + voting possibility of a post when on it.

    I use a CPT, and on the front page where I list all my posts, everything works perfectly. I use
    <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
    it displays the correct rating for every single post, and allows me to vote. But when I go on the single page of one of those posts, that same code gives me the average rating of all posts.

    When I use
    <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
    I get the average of all posts, not of the specific post I’m viewing.

    When I try
    `echo the_ratings_results(get_the_ID());’
    I see only results, but can’t vote.

    When I use
    <?php if(function_exists('the_ratings_vote')) { echo the_ratings_vote(get_the_ID()); } ?>
    it gives me the rating of that specific post, and allows me to vote, but doesn’t update. If I refresh the page it looks like I never voted.

    Can you please help?

    Thank you!

    https://www.ads-software.com/plugins/wp-postratings/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Lester Chan

    (@gamerz)

    It shouldn’t be the case because single post and the front loop does the same thing. Unless your single post page is not coded properly.

    Is it like that on the default theme?

    If not you can try <?php the_ratings('div', get_the_id()); ?>

    Thread Starter Nerina-01

    (@nerina-01)

    Hi, you are right, the problem was in my code.

    Before the ratings code I defined a variable called $id. That caused a conflict. After I changed it to $idparent, everything worked perfectly.

    Thank you very much for this plugin and for the quick response! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show rating on specific post allow to vote’ is closed to new replies.