Advertisement
geminilabs

Untitled

Jul 20th, 2023 (edited)
1,178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. add_filter('site-reviews/review/value/assigned_terms', function ($value, $tag) {
  2.     $brand = get_term_by('slug', 'brand', glsr()->taxonomy);
  3.     if (!$brand) {
  4.         return $value;
  5.     }
  6.     $terms = $tag->review->assignedTerms();
  7.     usort($terms, function ($a, $b) use ($brand) {
  8.         return $a->parent !== $brand->term_id ? strcmp($a->name, $b->name) : -1;
  9.     });
  10.     $values = wp_list_pluck($terms, 'name');
  11.     return !empty($values)
  12.         ? sprintf(__('Review of %s', 'site-reviews'), \GeminiLabs\SiteReviews\Helpers\Str::naturalJoin($values))
  13.         : '';
  14. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement