1. Home
  2. Docs
  3. Shortcodes
  4. YASR
  5. yasr_display_posts

yasr_display_posts

Description

Display your posts according to YASR ratings. This shortcode works only on pages.

By default, this shortcode uses the template that you can find inside the templates diretory.

If you wish, you can overide the default template, creating a new folder named yasr in your current theme.

For example, copy /templates/content.php to /your-theme/yasr/content.php and make the required changes. You’ll see the changes in the frontend. This way you can override the wordpress ratings plugin without modifying the plugin core, which might be replaced upon updates.


Parameters

orderby
(optional) The data source.
Accepted values:
vv_count: get data from yasr_visitor_votes, using rating count
vv_average: get data from yasr_visitor_votes, using average rating
overall: get data from yasr_overall_rating
default: vv_count
order
(optional) “desc” to order posts from the higher rated, “asc” vice versa
Accepted values: “desc”, “asc”
default: desc
posts_per_page
(optional) number of posts per page. Min: 2 Max: 20
default: 10

Examples

[yasr_display_posts]    will show the Visitor Votes with large stars set (default) for the current post or page.

[yasr_display_posts orderby=vv_average order=asc post_per_page=5]  will show 5 posts with the lowest average rating from yasr_visitor_votes data