Please consider me an absolute noob at Javascript. I only have a bit of experience with HTML, CSS and a little bit of PHP (wordpress relevant).
I have the following pop-up sign up form from Mailchimp that uses script tags.
<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us9.list-manage.com","uuid":"3fb38776176e5e9150749d44d","lid":"17c36a2172"}) })</script>
I am supposed to put it into the header, but since I am using a purchased child theme on Wordpress I cannot do this without issues with updates. The way around this is to use a plugin... I need to put this code into a .js file instead of the header. I have absolutely no idea how to do this and get it to run.
Can someone please help me?
答案 0 :(得分:0)
如前所述,打开链接,将内容复制到剪贴板,将其粘贴到本地计算机上的YOURFILE.js。
我回复强调并加上:不要在上面的行中包含开始和结束的SCRIPT标签等,这些东西会导致错误。
一旦您正确命名并将YOURFILE.js保存到您的插件可以访问的位置,您应该可以在家中免费使用。
将另一个选项添加到Wordpress,将YOURFILE.js添加到主题中,并根据Wordpress提供的说明在functions.php文件中注册命令。
请参阅https://developer.wordpress.org/themes/basics/including-css-javascript/#scripts
上的说明