【问题标题】:Contact Form 7 - Cannot get rid of 'send' from submit button联系表格 7 - 无法从提交按钮中删除“发送”
【发布时间】:2013-05-20 02:23:05
【问题描述】:

我一直在环顾四周,每个人都说解决方案是从以下代码中取出“发送”:

if ( empty( $value ) ) $value = __('send', 'wpcf7');

这是我用图像替换提交按钮后做的第一件事,但“发送”仍然覆盖在提交按钮图像上,我不知道该怎么做。这是我的 CSS 代码的样子:

/* Shortcode handler */

add_action( 'init', 'wpcf7_add_shortcode_submit', 5 );

function wpcf7_add_shortcode_submit() {
wpcf7_add_shortcode( 'submit', 'wpcf7_submit_shortcode_handler' );
}

function wpcf7_submit_shortcode_handler( $tag ) {
$tag = new WPCF7_Shortcode( $tag );

$class = wpcf7_form_controls_class( $tag->type );

$atts = array();

$atts['class'] = $tag->get_class_option( $class );
$atts['id'] = $tag->get_option( 'id', 'id', true );
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );

$value = isset( $tag->values[0] ) ? $tag->values[0] : '';

if ( empty( $value ) )
    $value = __(' ', 'wpcf7');


$atts['class'] = 'button';
$atts['type'] = 'submit';
$atts['value'] = $value;

$atts = wpcf7_format_atts( $atts );

$html = sprintf( '<input %1$s />', $atts );

return $html;
}

注意:我已经把“发送”去掉了,留下了一个像''而不是''的空格,事实上我已经尝试了所有组合但没有。

这与我创建提交按钮图像的方式有关吗?在最新版本的 CF7 中,我必须先将 $atts['class'] = 'button'; 添加到我的 submit.php 中,然后再将以下内容添加到我的 CSS 中

.button {
background-image: url("imageurl.gif");
background-repeat: no-repeat;
margin: 0px 0px 0px 0px;
padding: 0px;
float: left;
height: 35px;
width: 133px;
border: 0 none;
cursor: pointer;
}

任何帮助将不胜感激。

【问题讨论】:

    标签: php css wordpress contact-form-7


    【解决方案1】:

    反复试验。

    用“测试”之类的其他内容替换“提交”的所有内容,并更改每个内容,直到它工作为止。然后您将确切知道要更改哪一个。

    【讨论】:

      【解决方案2】:

      无需触摸代码即可更改提交按钮的消息。进入您的 wp 仪表板

      <p>[submit "Send"]</p>
      

      <p>[submit "Anything you would like here"]</p>
      

      【讨论】:

      • 哇,这就是为什么我找不到其他人问这个问题的原因,因为它太明显了。我真是个白痴。谢谢!
      【解决方案3】:

      在模块 submit.php 中的最新版本(撰写本文时)

      在第 27 行更改

      if ( empty( $value ) )
              $value = __( 'Send', 'contact-form-7' );
      

      if ( empty( $value ) )
              $value = __( ' ', 'contact-form-7' );
      

      【讨论】:

      • 这对我有用。不知道为什么简单的解决方案不起作用。我使用安装了插件的 WordPress 5.4.2。
      【解决方案4】:

      如果您正在使用联系表 7 寻找空白按钮

      [submit "&nbsp;"]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-09-05
        • 2015-04-16
        • 2018-10-03
        • 2021-04-11
        • 2018-01-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多