Advertisement
geminilabs

[site-reviews] change the default review count

Oct 9th, 2019
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. /**
  2.  * Changes the default number of displayed reviews from 5 to a custom number
  3.  * Paste this in your active theme's functions.php file
  4.  *
  5.  * @param array $attributes The default attributes
  6.  * @param string $type The type of output (i.e. shortcode, widget)
  7.  * @param string $name The name of the shortcode in dash-case
  8.  * @return string
  9.  */
  10. add_filter('site-reviews/shortcode/atts', function($attributes, $type, $name) {
  11.     if ('site-reviews' === $name) {
  12.         // change the number of displayed reviews to 10
  13.         $attributes['display'] = 10;
  14.     }
  15.     return $attributes;
  16. }, 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement