Advertisement
geminilabs

Untitled

Apr 20th, 2023
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. add_filter('site-reviews/review/value/assigned_links', function ($value, $tag) {
  2.     $links = [];
  3.     foreach ($tag->review->assigned_posts as $postId) {
  4.         $sports = get_the_terms($postId, 'sport');
  5.         if (is_array($sports)) {
  6.             foreach ($sports as $term) {
  7.                 $links[] = sprintf('<a href="%s">%s</a>',
  8.                     esc_url(get_term_link($term->slug, 'sport')),
  9.                     esc_html($term->name)
  10.                 );
  11.             }
  12.         }
  13.         $locations = get_the_terms($postId, 'location');
  14.         if (is_array($locations)) {
  15.             foreach ($locations as $term) {
  16.                 $links[] = sprintf('<a href="%s">%s</a>',
  17.                     esc_url(get_term_link($term, 'location')),
  18.                     esc_html($term->name)
  19.                 );
  20.             }
  21.         }
  22.     }
  23.     $categories = implode('&nbsp;|&nbsp;', $links);
  24.     return sprintf('%s<br>%s', $value, $categories);
  25. }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement