Divi Builder - 联系表单的动态内容 [英] Divi Builder - dynamic content for contact forms

查看:18
本文介绍了Divi Builder - 联系表单的动态内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Wordpress 网站上有一个酒店 CPT,我有这个 CPT 的特定页脚(即适用于所有酒店),其中包含联系表格.

I have a CPT of Hotels in my Wordpress Website, and I have a specific footer for this CPT (i.e. applies to all hotels), which contains a contact form.

目前,当用户向我发送电子邮件时,我不知道这封电子邮件来自哪家酒店.

Currently, when a user send me an email I don't know from which hotel this email came from.

如何以交互方式将一些动态文本添加到我可以识别酒店的消息中(例如,向我显示页面标题或发送表单的页面链接).

How could I interactively add some dynamic text to the message that I could identify the hotel (for example, showing me the page title, or the page link in which the form was sent).

推荐答案

请按照以下步骤操作:

  1. 将表单id"设置为hotel-reservation".
  2. 向您的表单添加一个隐藏的输入并将 ID 设置为引用".
  3. 将此 js 代码添加到您的全局 javascript 中:

  1. Set the form "id" to "hotel-reservation".
  2. Add a hidden input to your form and set the id to "reference".
  3. Add this js code to your global javascript:

jQuery( document ).ready(function() {

   $("#hotel-reservation").submit(function(){
      $('input#reference').val( $(location).attr('href') );
   });
});

这篇关于Divi Builder - 联系表单的动态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆