WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Ratings being displayed even though they haven't been rated

[Resolved] Ratings being displayed even though they haven't been rated

  • Hi, so I’ve been trying to use your plugin with my custom theme for my wordpress website. I’ve been trying to add the following code to my single.php page, but whenever I browse to a blog post that I know I haven’t rated, it displays a vote for it already.

    The code I added was:

    <div id="rating-block">
                    <h5>Rate Article</h5>
                    <?php if(function_exists('the_ratings')) { $post = $temp; the_ratings(); } ?>
                </div>

    Any help would be appreciated.

    http://wordpress.org/plugins/wp-postratings/

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

    @gamerz

    Why are you assigning $temp to $post?

    I was testing out whether or not $post changes (since I run a whole bunch of WP_Query’s above that code). So I assigned $temp to global $post to keep track of the current page’s post.

    Plugin Author Lester Chan
    Participant

    @gamerz

    So does it change?

    I would recommend http://codex.wordpress.org/Function_Reference/wp_reset_query after each query post. u might need to check the ratings function to see if the post id being pass to it is correct.

    I got a feeling this has nothing to do with the plugin but how is your theme handling the post in the query.

    Thanks, that worked.

    It was an issue to do with the system not understanding which post it was on, therefore showing the wrong rating for that page!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Ratings being displayed even though they haven't been rated’ is closed to new replies.