This may or may not be related to GP but I used to run this code in the previous theme and it worked. It’s a script inside fucntions.php to show ad “Admin” label for authors of the blog post within WordPress comments. Since launching 2 sites in GP, I cannot even get WordPress to accept this inside functions.php. Check another old site not using GP and it still works. Maybe someone who has more expertise in this area can guide me through this? When I try to add this inside WP Editor for functions.php, I get this error: “syntax error, unexpected ‘}’, expecting end of file”
// Get comment author role
function wpb_get_comment_author_role($author, $comment_id, $comment) {
$authoremail = get_comment_author_email( $comment);
// Check if user is registered
if (email_exists($authoremail)) {
$commet_user_role = get_user_by( ’email’, $authoremail );
$comment_user_role = $commet_user_role->roles[0];
// HTML output to add next to comment author name
// $this->comment_user_role = ‘ <span class=”comment-author-label comment-author-label-‘.$comment_user_role.'”>’ . ucfirst($comment_user_role) . ‘</span>’;
$this->comment_user_role = ‘ <span class=”comment-author-label comment-author-label-‘.$comment_user_role.'”>admin</span>’;
} else {
$this->comment_user_role = ”;
}
return $author;
}
// Display comment author
function wpb_comment_author_role($author) {
return $author .= $this->comment_user_role;
}
}
new WPB_Comment_Author_Role_Label;
endif;