Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('site-reviews/review/wrap', function ($context, $review) {
- $firstAssignedPostId = array_shift($review->assigned_posts);
- if (!empty($firstAssignedPostId)) {
- glsr_log([
- 'assigned_post_type' => get_post_type($firstAssignedPostId),
- 'product_id' => $firstAssignedPostId,
- 'product_featured_image' => get_the_post_thumbnail($firstAssignedPostId, 'site-reviews-avatar'),
- ]);
- $context['avatar'] = get_the_post_thumbnail($firstAssignedPostId, 'site-reviews-avatar');
- } else {
- glsr_log(sprintf('The review with an ID of %s is not assigned to a product', $review->ID));
- }
- return $context;
- }, 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement