[Resolved] Add script after footer content

Home Forums Support [Resolved] Add script after footer content

Home Forums Support Add script after footer content

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

    Hello Tom,

    I’m trying to add below code to the footer area, ideally right after my Copyright Content as it will only be a small image shown.
    <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1273741166'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s22.cnzz.com/z_stat.php%3Fid%3D1273741166%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>

    Problem is: when I add it from the customizer, in the box of the copyright content, it will mess up the page. If I use the wp-footer or after footer content hook, it will actually show up below the copyright area and align all the way left in the new line.

    Could you please guide me on how to fix this?

    Thank you
    Leon

    GeneratePress 2.1.2
    GP Premium 1.6.2
    #579426
    David
    Staff
    Customer Support

    Hi Leon,

    you can use GP Hooks:

    https://docs.generatepress.com/article/hooks-overview/

    Add the code to the After Footer Content Hook – if you want the ‘icon’ to appear after the copyright on the same line you could add this:

    <div class="grid-container" style="text-align: center;">
        © <?php echo date('Y'); ?> My Copyright &nbsp;
        <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1273741166'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s22.cnzz.com/z_stat.php%3Fid%3D1273741166%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>
    </div>

    Make sure you check execute PHP on the hook if you use this code

    #579810
    Leon

    Hi David,

    Thank you for the help. This doesn’t solve the problem I was facing. If I use the code and leave the copyright section empty, the default GP copyright will be shown.

    However, I’ve made it the same background color and center aligned the content. Reserved what I have in the copyright area from the customizer and it looks ok now.

    Thank you
    Leon

    #580620
    David
    Staff
    Customer Support

    Hi Leon,

    glad you have it resolved, just so you know you can just add a space to the copyright section to leave it blank

    #582281
    Leon

    Thank you David!

    #582455
    David
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.