geminilabs

[site-reviews] add an "assigned_to_image" template tag

Mar 20th, 2019 (edited)
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. /**
  2.  * Adds an "assigned_to_image" template tag
  3.  * Paste this in your active theme's functions.php file.
  4.  * @param \GeminiLabs\SiteReviews\Review $review
  5.  * @param array $context
  6.  * @return array
  7.  */
  8. add_filter('site-reviews/review/build/after', function($context, $review) {
  9.     $context['assigned_to_image'] = '';
  10.     $postId = glsr_get($review->assigned_posts, 0);
  11.     if (!empty($postId)) {
  12.         $context['assigned_to_image'] = get_the_post_thumbnail($postId, 'thumbnail');
  13.     }
  14.     return $context;
  15. }, 10, 2);
Add Comment
Please, Sign In to add comment