Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #494438

    Hey,

    Where can I add code just before the </body> tag?

    Thanks
    Charlotte
    http://www.newyorkinspiration.com

    #494442

    Something like this:

    <script type=”text/javascript”>
    (function() {var s = document.createElement(‘script’);s.type = ‘text/javascript’;s.async = true;
    s.src = document.location.protocol + ‘//loader.wisepops.com/default/index/get-loader?user_id=18047’;
    var s2 = document.getElementsByTagName(‘script’)[0];s2.parentNode.insertBefore(s, s2);})();
    </script>

    #494453

    Hey!

    You can use the wp_footer hook (place it in your theme / child theme functions.php):

    add_action('wp_footer', function() {
    ?>
    <script type=”text/javascript”>
    (function() {var s = document.createElement(‘script’);s.type = ‘text/javascript';s.async = true;
    s.src = document.location.protocol + ‘//loader.wisepops.com/default/index/get-loader?user_id=18047′;
    var s2 = document.getElementsByTagName(‘script’)[0];s2.parentNode.insertBefore(s, s2);})();
    </script>
    <?php
    });

    Regards,
    Josue

    #494651

    OK, thanks but what happens when I update the theme?
    Will I lose it then?

    Thanks
    Charlotte

    #494654

    Hey!

    Use this plugin to store the custom function there instead of the theme functions.php:
    https://wordpress.org/plugins/functionality/

    Best regards,
    Josue

    #494890

    Thanks…

    the code you suggested did not work in functions.php but when I added just my code in the footer file it worked.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Add code before body tag’ is closed to new replies.