首页 > 解决方案 > 使用图片作为联系表格 7 上的单选按钮,但未在邮件中接收图片

问题描述

我使用了下面的这段代码,它在 wordpress function.php 中非常有用,用于联系表格 7 选择图像作为复选框,但它没有通过电子邮件接收,请在这件事上帮助我,谢谢

这是代码

function add_shortcode_imageradio() {
    wpcf7_add_shortcode( 'imageradio', 'imageradio_handler', true );
}
add_action( 'wpcf7_init', 'add_shortcode_imageradio' );

function imageradio_handler( $tag ){
    $tag = new WPCF7_FormTag( $tag );

    $atts = array(
        'type' => 'radio',
        'name' => $tag->name,
        'list' => $tag->name . '-options' );

    $input = sprintf(
        '<input %s />',
        wpcf7_format_atts( $atts ) );
        $datalist = '';
        $datalist .= '<div class="imgradio">';
        foreach ( $tag->values as $val ) {
        list($radiovalue,$imagepath) = explode("!", $val
    );

    $datalist .= sprintf(
     '<label><input type="radio" name="%s" value="%s" class="hideradio" /><img src="%s"></label>', $tag->name, $radiovalue, $imagepath 
    );

    }
    $datalist .= '</div>';

    return $datalist;
}

这是我正在处理的页面: https ://www.commforceintl.com/lost-and-found-english/

标签: wordpressformsfunctioncontact-form-7

解决方案


推荐阅读