javascript mailchimp 弹出窗体未显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30165443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 11:50:21  来源:igfitidea点击:

mailchimp popup form not showing up

javascriptwordpressformspopupmailchimp

提问by maddy

I have created a popup form in my mailchimp account and I cannot get it to show up on my site. The code generated is

我在我的 mailchimp 帐户中创建了一个弹出表单,但我无法让它显示在我的网站上。生成的代码是

<script type="text/javascript" src="s3.amazonaws.com/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":"xxxx-xxxxx.com","uuid":"xxxxxxxxxxx","lid":"xxxxxxxx"}) })</script>

I tried adding it to header.php, footer.php in wordpress but it doesn't work.

我尝试将它添加到 wordpress 中的 header.php、footer.php 但它不起作用。

采纳答案by Stuart Hannaford

Your issue is probably that the correct jquery version is not being called. I believe you need a minimum of 1.4.4 and you may find if you have a look at the link below it is a problem with how the pop up is looking for the jquery.js file:

您的问题可能是未调用正确的 jquery 版本。我相信您至少需要 1.4.4,如果您查看下面的链接,您可能会发现弹出窗口如何查找 jquery.js 文件存在问题:

https://www.organicweb.com.au/19561/wordpress/mailchimp-popup-instructions/

https://www.organicweb.com.au/19561/wordpress/mailchimp-popup-instructions/

回答by ubershmekel

It might be that you yourself are already subscribed. Here's JS that can delete the cookie that marks that:

可能是您自己已经订阅了。这是可以删除标记的 cookie 的 JS:

document.cookie = "MCPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";
document.cookie = "MCPopupSubscribed=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/";

回答by mark

I believe mailchimp uses cookies to display the popup only once, so once you see it once on your site, it won't display again unless you delete your cookies. Not sure if there is a setting to change this or not.

我相信 mailchimp 使用 cookie 只显示一次弹出窗口,所以一旦你在你的网站上看到它一次,它就不会再次显示,除非你删除你的 cookie。不确定是否有设置可以更改此设置。

回答by exiang

it could be conflict with existing jquery.

它可能与现有的 jquery 冲突。

the embed.js will auto search for jquery.js at the web root directory. just place the file there and it should works.

embed.js 将在 web 根目录自动搜索 jquery.js。只需将文件放在那里,它应该可以工作。

if you do not want to mess up your web root by creating another duplicate jquery js file, you can use htaccess to map it to your existing path.

如果您不想通过创建另一个重复的 jquery js 文件来弄乱您的 web 根目录,您可以使用 htaccess 将其映射到您现有的路径。

RewriteEngine on Options +FollowSymLinks RewriteRule ^/?jquery.js$ /themes/inspinia/vendors/jquery/jquery-2.1.1.js [L]

RewriteEngine on Options +FollowSymLinks RewriteRule ^/?jquery.js$ /themes/inspinia/vendors/jquery/jquery-2.1.1.js [L]

or, visit this page for more detail: https://www.organicweb.com.au/19561/wordpress/mailchimp-popup-instructions/

或者,访问此页面了解更多详情:https: //www.organicweb.com.au/19561/wordpress/mailchimp-popup-instructions/