- This topic has 5 replies, 2 voices, and was last updated 4 years, 11 months ago by
Tom.
-
AuthorPosts
-
March 15, 2016 at 9:41 pm #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?
March 15, 2016 at 9:50 pm #179614Tom
Lead DeveloperLead DeveloperHi 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 π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 15, 2016 at 10:58 pm #179631Dmitry 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>
<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’);
Box.getScripts(‘simplebox_js’,’http://tradebonds.ru/simplebox.js’,function(){
simplebox.init();
for(i=0,l=els.length;i<l;++i)
simplebox.start(els);
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?
March 15, 2016 at 11:59 pm #179642Tom
Lead DeveloperLead DeveloperAdding 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 16, 2016 at 1:19 am #179651Dmitry 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!
March 16, 2016 at 10:33 am #179721Tom
Lead DeveloperLead DeveloperGreat, glad it’s working now π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.