The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
show just average r...
 
Share:
Notifications
Clear all

show just average rating

8 Posts
2 Users
0 Likes
2,643 Views
Posts: 5
 jjk
Topic starter
(@jjk)
Active Member
Joined: 4 years ago

Hi,

how can I show just the stars representing the average rating for a post in either the single post or archive page 

Thanks

7 Replies
Asti
Posts: 7105
 Asti
Support
(@asti)
Illustrious Member
Joined: 6 years ago

Hi @jjk,

Please read this doc: https://wpdiscuz.com/docs/wpdiscuz-documentation/settings/comment-list-settings/#display_ratings

Reply
5 Replies
 jjk
(@jjk)
Joined: 4 years ago

Active Member
Posts: 5

Hi @asti,

thanks for the swift reply! 

I did read that and have the options before/after post enabled, but not rating shows. I am assuming it's an effect of the theme I am using (mh-magazine), so I would like to add it manually (shortcode or else?).

Thanks,
JJ

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

Illustrious Member
Posts: 7105

yes @jjk, you can use wpdrating shortcode in post content to display rating average and stars. 

See the example below:

[ wpdrating metakey="all" show-label=false itemprop=false ]
Reply
 jjk
(@jjk)
Joined: 4 years ago

Active Member
Posts: 5

@asti

thanks again. Is there a place where the options are documented?

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

Illustrious Member
Posts: 7105

@jjk,

I'm sorry, but no documatation yet. 

See the description below:

1. metakey is the value of the meta key for the rating field. If you set it "all" the total count will be displayed. 

2. show-label - if you set "true" as a value of the property the "Name For Total" will be displayed, otherwise not.

3. the value of the itemprop property is being used for showing agregates.  If you set it false it'll not be indexed by Google. 

metakey
Reply
 jjk
(@jjk)
Joined: 4 years ago

Active Member
Posts: 5

@asti

thanks for the description - sadly, it doesn't do anything for me. A post that has a rating and a comment, nothing shows with the above shortcode. I will look into it a bit more, but than probably let it go for now.

Thanks anyways for being so responsive!

 

Reply
Posts: 5
 jjk
Topic starter
(@jjk)
Active Member
Joined: 4 years ago

@asti

after looking into this a bit, I think here might be a small bug in the code..

in the Form.php, within public function getRatingMetaHtml on or around line 950 (not sure exact as I messed around with it) the code calls the function itself again 

 $html = $form->getPostRatingMetaHtml($atts);
while I believe it should be
 $html = $form->getPostRatingHtml($atts);
at least with that modification, it does show the image with total ratings and stars.

However, there is no way to only show the stars, which would be desireable for example in an archive view or as a small indicator behind a posts title. For that, I have copied the getPostRatingHtml() function to a new one getPostRatingStarsHtml() and deleted all html that isn't necessary to show only the 5 stars inline with adjacent text. 

 
While it works now, I will refrain from using this fix as it requires changes in the plugin's core code and I don't like that. So hopefully, that's a feature you guys want to consider for a future release and until then, I will use something else.
 
Thanks, JJ
Reply
Share: