Hi
Is there a javascript snippet I can include in my child functions file to add the <sup> tags around the copyright © symbol please?
Unfortunately it cannot be targeted with css without the <sup> tag.
I have hundreds across my site and it is not practical to add one by one, it will take days!!
Any advice is massively appreciated!
Many thanks
Hey zerodotnine,
We don’t have a ready solution for that unfortunately, maybe this will help you out though? https://stackoverflow.com/questions/884140/javascript-to-add-html-tags-around-content
Best regards,
Rikard
can you try this in your child-theme functions.php:
function wrap_copyright_text_with_sup(){
?>
<script>
(function($) {
$(document).ready(function() {
$('body :not(script)').contents().filter(function() {
return this.nodeType === 3;
}).replaceWith(function() {
return this.nodeValue.replace(/[™®©]/g, '<sup>$&</sup>');
});
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'wrap_copyright_text_with_sup');
it includes TM and ® and ©
PS: Node.TEXT_NODE (3) ⇒ The actual Text inside an Element or Attr.
PPS: Yes me too i’m happy that Rikard could help ;)
Thank you so much, that worked PERFECTLY!
Hi,
Great, I’m glad that you got it working. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
Rikard
Hi,
Glad Rikard could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike