如何动态更改联系表单7提交显示消息

问题描述 投票:0回答:2

有人知道如何使用 WordPress 的联系表单 7 插件发布页面链接吗?

因此,在您点击发送后,应该会弹出“谢谢您的消息”标志,我想在此处放置一个链接。

这是我要输入页面链接的地方 This is where I want to input the page link

wordpress contact-form-7
2个回答
1
投票

编辑:自 CF7 插件 v5 起,无法再显示 HTML 标记文本,由于报告的问题herehere

,只能使用简单文本

编辑 2021 年 10 月:如果您安装 CF7 的 Smart Grid-layout 插件扩展,此解决方案现在可以再次使用。提交表单后,该插件将在前端显示您的 HTML 格式的响应。

编辑 2023 年 10 月 CF7 插件在此过程中不断更改其代码破坏扩展。智能电网现已更新,可以使用以下过滤器提交 HTML 丰富消息,

add_filter( 'cf7sg_submission_response', 'html_response', 10, 4 );
function html_response( $msg, $status, $data, $cf7key ) {
  if( 'my-form' === $cf7key && 'mail_sent' === $status){
      $msg= 'Hello click <a href="#here">here</a>';
  }
  return $msg;
}

0
投票

2022 年 3 月: 提到的智能网格布局插件没有解决问题,消息仍然只是纯文本。

目前唯一的解决方案是https://contactform7.com/2016/01/27/html-is-not-allowed-in-messages/

但是可能需要大量的返工,具体取决于您的实现的定制程度。

2022 年 9 月: 我使用 https://contactform7.com/dom-events/

重建了它

样品:

document.addEventListener( 'wpcf7submit', function ( event ) {
var status = event.detail.status;
if ( status === 'spam' ) {}...
© www.soinside.com 2019 - 2024. All rights reserved.