wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

Display Post rating and number of ratings in the loop


psi
Posts: 6
 psi
Topic starter
(@psi)
Active Member
Joined: 7 months ago

Hi there.

I'm new to this forum and not working with WP for long. I would like to use this awesome plugin and want to show the rating score and number of ratings in the loop. I haven't found any HowTo do this in the forum, so maybe anyone can point me in the right direction ?

I'm using Elementor and Crocoblock components with wordpress.

Thanks. psi

5 Replies
Asti
Posts: 4845
 Asti
Support
(@asti)
Support member
Joined: 5 years ago

@psi,

You can use the shortcode provided here: https://wpdiscuz.com/community/f-a-q/wpdiscuz-shortcode-2/

Reply
4 Replies
psi
 psi
(@psi)
Joined: 7 months ago

Active Member
Posts: 6

@asti thanks for the fast reply ๐Ÿ™‚ I have seen this post, but assumed this is for the comment rating rather than for Post rating. How can I set the post id in the loop or maybe I don't have to ?

Reply
Asti
 Asti
Support
(@asti)
Joined: 5 years ago

Support member
Posts: 4845

@psi,

It should be a postid variable.ย 

Reply
psi
 psi
(@psi)
Joined: 7 months ago

Active Member
Posts: 6

@asti It doesn't show anything, even with a static postid.

Reply
Asti
 Asti
Support
(@asti)
Joined: 5 years ago

Support member
Posts: 4845

@psi,

The wpDiscuz has two types ofย  ratings:ย 

  1. Stand-alone Post Rating
  2. Post Rating Based on Comment Rating Field

the shortcode works only for the second type.ย 

In the case of the first one, you should get the values from the database.

Those are stored in the wp_wc_users_rated table.ย 

Also in the wp_postmeta table where the keys are:

  • wpdiscuz_post_rating - the post rating
  • wpdiscuz_post_rating_count - the count of the rate

The wp_ is just a prefix in your case it can differ.ย 

Reply
Share: