在构建网站时,我尝试使用CF7的动态文本插件来填充基于前一个网站的字段。
但是,在加载联系人页面后,虽然它会显示所需的URL (从offer传递到联系人页面"www.webpage.com/ contact ?offer1“),但下拉菜单不会显示所需的选项。
基本上
在优惠页面上时>按“立即联系”按钮>使用预先提交的优惠字段加载CF7。
使用Calluna主题和WP 4.9.9
我试着在wordpress中使用动态选择扩展,我使用了一个短代码来选择,但它不起作用。如果用"if if else“语句来代替它,那将是完美的。这样的东西能行得通吗?
$(document).ready(function () {
if(window.location.href.contains("?offer1") -1) {
select("offer1");
}
if else(window.location.href.contains("?offer2") -1) {
select("offer2");
}
if else(window.location.href.contains("?offer3") -1) {
select("offer2");
}
if else(window.location.href.contains("?offer4") -1) {
select("offer2");
}
else{
select("Angebote");
}
});
发布于 2019-01-28 09:27:52
这不是walid的方式。使用下面的方法;
$(document).ready(function () {
var matchedData = window.location.href.match(/\?(offer(\d))/);
if (matchedData) {
select(matchedData[1]);
return;
}
// default behaviour
select("Angebote");
});
。。需要映射操作的情况:
$(document).ready(function () {
var matchedData = window.location.href.match(/\?(offer(\d))/);
var actionsMap = new Map([["offer3", "offer2"], ["offer4", "offer2"]])
if (matchedData) {
var actionName = actionsMap.get(matchedData[1]) || matchedData[1];
select(actionName);
return;
}
// default behaviour
select("Angebote");
});
https://stackoverflow.com/questions/54398452
复制相似问题