[Resolved] how to put "my code" into footer.php without being deleted after updates?

Home Forums Support [Resolved] how to put "my code" into footer.php without being deleted after updates?

Home Forums Support how to put "my code" into footer.php without being deleted after updates?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #179613
    Dmitry Bychenko

    Hi,guys,

    i put a script into footer.php, but after update footer.php got replaced by a new footer.php which is ok.
    for now i pout this script again into new footer.php and waiting for a new update:)

    i tried to put this script into wp_footer hook (im not advanced html css php whatever coder) i dont even know if it should work that way, but it didnt work.

    how to avoid script to be deleted from footer.php?

    #179614
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    If you have GP Hooks you can add it into the wp_footer hook in “Appearance > GP Hooks”.

    If not, you’ll need to use a function like:

    add_action( 'wp_footer','generate_my_custom_wp_footer' );
    function generate_my_custom_wp_footer()
    {
    ?>
        Add your stuff in here
    <?php
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    Hope this helps ๐Ÿ™‚

    #179631
    Dmitry Bychenko

    Thanks, Tom,

    yes, i have GP Hooks (Premium), i tried to put stuff there, but it didnt work. and i checked Execute php.

    the script is:
    <script type=”text/javascript” src=”http://tradebonds.ru/simplebox_util.js”></script&gt;
    <script type=”text/javascript”>
    (function(){
    var boxes=[],els,i,l;
    if(document.querySelectorAll){
    els=document.querySelectorAll(‘a[rel=simplebox]’);
    Box.getStyles(‘simplebox_css’,’http://tradebonds.ru/simplebox.css&#8217;);
    Box.getScripts(‘simplebox_js’,’http://tradebonds.ru/simplebox.js&#8217;,function(){
    simplebox.init();
    for(i=0,l=els.length;i<l;++i)
    simplebox.start(els[i]);
    simplebox.start(‘a[rel=simplebox_group]’);
    });
    }
    })();</script>

    Script should be put before </body> in footer.php

    what is the correct way to put it in wp_footer?

    #179642
    Tom
    Lead Developer
    Lead Developer

    Adding it into wp_footer should be all that is needed.

    If it’s not working still, there must be some sort of issue with the code itself I’m afraid.

    #179651
    Dmitry Bychenko

    Thanks, Tom,

    the strange thing is now it’s working. it didnt work when i tried it first time.
    maybe ive done something wrong last time.

    sorry for that.

    anyway, im very happy with GP and your support, thank you!

    #179721
    Tom
    Lead Developer
    Lead Developer

    Great, glad it’s working now ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.