Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1350619

    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

    #1350642

    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

    #1350661

    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 ;)

    #1350671

    Hi,

    Thanks for sharing and for helping out @guenni007 :-)

    Best regards,
    Rikard

    #1350789

    Thank you so much, that worked PERFECTLY!

    #1350802

    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

    #1350809
    This reply has been marked as private.
    #1350826

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Copyright symbol line height – Javascript functions solution?’ is closed to new replies.