Advertisement
geminilabs

[site-reviews] Only use initials avatars and change colour

Aug 26th, 2022 (edited)
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. /**
  2.  * Change the initials avatar colours to gray with white text
  3.  * @return array
  4.  */
  5. add_filter('site-reviews/avatar/colors', function () {
  6.     return [
  7.         ['background' => '#aaa', 'color' => '#fff'],
  8.     ];
  9. });
  10.  
  11. /**
  12.  * Only display initials avatars; make sure to disable the "Regenerate Avatars" setting.
  13.  * @param array $attributes
  14.  * @param \GeminiLabs\SiteReviews\Review $review
  15.  * @return array
  16.  */
  17. add_filter('site-reviews/avatar/attributes', function ($attributes, $review) {
  18.     if ('initials' === glsr_get_option('reviews.avatars_fallback')) {
  19.         $attributes['src'] = glsr('Modules\Avatar')->generateInitials($review);
  20.     }
  21.     return $attributes;
  22. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement