I am currently trying to add this code to a PHP file:
if (contains($current_url, $bad_urls_2)) {
echo '<script>
$('body :not(script,sup)').contents().filter(function() {
return this.nodeType === 3;}).replaceWith(function() {
return this.nodeValue.replace(/[®]/g, '<sup>$&</sup>');
});</script>';
}
the issue with this is that it outputs this error: Error: syntax error, unexpected 'body' (T_STRING), expecting ',' or ';': syntax error, unexpected 'body' (T_STRING), expecting ',' or ';'
The if statement is not necessary for this issue, as it only checks if there is a word in an URLs and then applies this code only to the pages that match them.
'(single quote) beforebodywhich closes the sting you started on the previous line