admin管理员组文章数量:1293314
I need to put this script above the tag in the header.php.
window.Futy = { key: '0000000000' }; (function (e, t) { var n = e.createElement(t); n.async = true; n.src = '.js'; var r = e.getElementsByTagName(t)[0]; r.parentNode.insertBefore(n, r); })(document, 'script');But with the new header.php and hooks and function.php I don't know how to do this. I'm not a developer. So please tell me in a easy way as possible
I need to put this script above the tag in the header.php.
window.Futy = { key: '0000000000' }; (function (e, t) { var n = e.createElement(t); n.async = true; n.src = 'https://v1.widget.futy.io/js/futy-widget.js'; var r = e.getElementsByTagName(t)[0]; r.parentNode.insertBefore(n, r); })(document, 'script');But with the new header.php and hooks and function.php I don't know how to do this. I'm not a developer. So please tell me in a easy way as possible
Share Improve this question asked May 5, 2021 at 9:23 HennoHenno 1 5 |1 Answer
Reset to default 2As @Buttered_Toest mentioned, this snippet works well.
(This code goes to functions.php)
function futy_widget_footer(){ ?>
<script>
window.Futy = { key: '0000000000' }; (function (e, t) { var n = e.createElement(t); n.async = true; n.src = 'https://v1.widget.futy.io/js/futy-widget.js'; var r = e.getElementsByTagName(t)[0]; r.parentNode.insertBefore(n, r); })(document, 'script');
</script>
<?php }
add_action('wp_footer','futy_widget_footer');
本文标签: functionsNeed to put a script above ltbodygt tag in headerphpWP 571
版权声明:本文标题:functions - Need to put a script above <body> tag in header.php - WP 5.7.1 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741576209a2386297.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
<head>
tag, than you need to hook intowp_head
action – Buttered_Toast Commented May 5, 2021 at 9:41wp_footer
action – Buttered_Toast Commented May 5, 2021 at 9:47