Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Customises the response title
- * REQUIRES SITE REVIEWS >= v4.0.6
- * Paste this in your active theme's functions.php file
- *
- * @param string $responseHtml The response HTML
- * @param string $value The raw response value
- * @param string $review The review the response belongs to
- * @return string
- */
- add_filter('site-reviews/review/build/response', function($responseHtml, $value, $review) {
- if (is_numeric($review->assigned_to)) {
- // Get the title of the assigned page
- $responseFrom = get_post($review->assigned_to)->post_name;
- // OR, get the page author display name
- // $responseFrom = get_the_author($review->assigned_to);
- // OR, get the name of the manager saved to the page in a Custom Field
- // $responseFrom = get_post_meta($review->assigned_to, 'assigned_manager_name', true);
- if (!empty($responseFrom)) {
- $search = 'Response from '.get_bloginfo('name');
- $replace = 'Response from '.$responseFrom;
- $responseHtml = str_replace($search, $replace, $responseHtml);
- }
- }
- return $responseHtml;
- }, 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement