wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

[Solved] rating in archives


face2005
Posts: 4
Topic starter
(@face2005)
New Member
Joined: 10 months ago

Hey!
How do I display the rating on the archive page?
shortcode doesn't work like that.

Topic Tags
5 Replies
Asti
Posts: 3913
 Asti
Support
(@asti)
Support member
Joined: 4 years ago

@face2005,

You can use the "Display Ratings" option. More info here: https://wpdiscuz.com/docs/wpdiscuz-7/plugin-settings/article-and-comment-rating/#display-ratings

face2005
Posts: 4
Topic starter
(@face2005)
New Member
Joined: 10 months ago

there is no function to display the rating by the post id?

2 Replies
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3913

@face2005,

Please add the post_id attribute in the shortcode.

Your shortcode should look like this:



For example for the post with post_id= 5555 you should use the following shortcode:

face2005
(@face2005)
Joined: 10 months ago

New Member
Posts: 4
@asti

<?php $rating = new WP_Query( array(
'post_type' => 'teachers',
'p' => 555
) ); ?>
<?php while ( $rating->have_posts() ) : $rating->the_post(); ?>
<div class="lessonRating">
<?php echo do_shortcode( ' ' ); ?>
</div>

<?php endwhile; wp_reset_postdata(); ?> 
face2005
Posts: 4
Topic starter
(@face2005)
New Member
Joined: 10 months ago

thank you, it works!

Share: