- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试创建一个选项,供人们选择 WP CF7 表单中的图像。因为他们只能选择一个选项,所以在我看来,使用单选按钮功能是最好的方法。我在 https://wpquestions.com/Need_Image_as_a_Radio_Button_in_Contact_Form_7/19618#answer_16362 上找到了一个代码示例但是添加代码确实 a) 不会在管理部分创建标签,并且 b) 只返回页面上的完整短代码,而不是返回所需的图像。
我确实找到了这个 How to make custom form-tag in contact form 7 required在这个论坛上。我尝试添加
add_action( 'wpcf7_init', 'wpcf7_add_form_tag_imageradio' );
但它返回了以下错误:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wpcf7_add_form_tag_imageradio' not found or invalid function name in /home2/clay/public_html/wp-includes/class-wp-hook.php on line 298
关于如何解决这个问题的任何想法?使用的主题是 OnePage Express
最佳答案
你需要把两个论点:
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;
}
不要忘记 CSS:
input.hideradio{ /* HIDE RADIO */
visibility: hidden; /* Makes input not-clickable */
position: absolute; /* Remove input from document flow */
}
.imgradio label > input + img{ /* IMAGE STYLES */
cursor:pointer;
border:2px solid transparent;
}
.imgradio label > input:checked + img{ /* (RADIO CHECKED) IMAGE STYLES */
border:2px solid #f00;
}
并使用在 contactform7 的 FORM 选项卡内声明的新简码:
[imageradio radio-312
"Value1!http://[YourImgUrl]"
"Value2!http://[YourImgUrl]"
]
在例子中Need Image as...他们错过了包含“add_action”,仅此而已
可以查看CF7 doc还有
希望有帮助!
关于php - 在 Contact Form 7 上使用图像作为单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45740637/
我正在开发一个应用程序,我在其中显示来自服务器的一些联系人,目前我正在对来自服务器的联系人进行排序,但现在我想使用 IOS -> 设置 -> 联系人 -> 显示顺序读取联系人设置新的联系人框架,我没有
我希望检测一个(球)何时接触另一个物体(目标),并且我希望知道该接触的冲动。 我知道三种检测联系人的方法 gContactAddedCallback 或 int numManifolds =
我正在开发我的第一个 Android 应用程序,想知道我可以调用什么来显示这个“联系人 Pane ”: 当然,我指的是下方带有联系人照片、姓名和操作图标的小 Pane 。 作为一个相关问题...这个小
我正在研究如何从 android 上的联系人列表中导入数据。在模拟器中,我注意到一个位于顶部的联系人组,其中只包含一个我自己的联系人。其余联系人如下。 但是,当我使用下面的代码时 Intent pic
如何添加从地址簿/联系人列表导入联系人号码并将其添加到数组中的功能? 编辑 如果您看过高级通话管理器应用程序,它允许您从联系人列表中选择联系人并将其添加到黑名单。我想做同样的事情,从联系人列表中选择一
我正在阅读有关内容提供商的信息,并且对从 android 中选择联系人有点困惑。我从 Stackoverflow 中阅读了很多示例,并且混淆了一些人正在使用 content://contacts/pe
.NET 有许多不同的 Google API dll,例如 Google.Apis.Calendar.v3。但联系人 API 没有任何内容。使用旧版本或其他方法并不是解决方案,因为我已经使用了多个 A
我收到此错误 django.urls.exceptions.NoReverseMatch:未找到“联系人”的反向。 “contact”不是有效的 View 函数或模式名称。我可能做错了什么,djang
每当我使用 Google Contacts Api v3 列出我的联系人时,查询都会返回 480 个结果,而我在我的联系人上只有 269 个联系人列表。 我正在尝试过滤它们,以便它只显示来自我的联系人
我正在使用 django 1.3.1 和 satchmo 0.9.2。我使用了 Satchmo 附带的默认模型,称为“Contact”。我创建了一个 satchmo_mod 应用程序和一个 admin
当我使用“这个解决方案”时,我得到一个空白的联系人数组。 我在 examples/contacts 文件夹中使用“google-api-php-client-0.6.7”和 serviceAccoun
使用 ABAddressBook,当我希望用户能够为他们以前从未见过的联系人选择“创建新联系人”和“添加到现有联系人”选项时,我会创建并显示一个 ABUnknownPersonViewControll
我正在探索 ionic 4 中的新导航(类型为 angular),您可以在选项卡项目中找到它 href="/tabs/(contact:contact)" 什么是 (contact:contact)
我已经使用这个 API 6 年了,没有任何问题,但是从 3 天前开始,我遇到了一系列奇怪的行为,意识到我的 google 联系人开始不受控制地复制。我发现它与检索联系人时 1.500 的奇怪限制有关,
我在 main 中初始化了 box 数据库如下 void main() async { WidgetsFlutterBinding.ensureInitialized(); final
我使用 var contacts:[details] 编写代码? = nil 我遇到了无法访问 contacts?.count 的问题,我不得不在任何地方使用可选值。例如 contacts[index
我正在从我的手机联系人列表中获取我的联系人图像 uri。 但是,当我尝试将图像 uri 转换为位图时,我收到错误: java.io.FileNotFoundException: content://c
我浏览了很多帖子,但没有找到任何有效甚至正确回答问题的答案。我最接近的是这个 How to avoid duplicate contact name (data ) while loading con
我正在使用 Google Contact API v3。目标是在我的数据库和 Google 帐户之间同步联系人。我的问题是: 1) 当我在没有联系人组的情况下通过电子邮件地址搜索联系人时,我得到了一个
我想在联系表单 7 中的特定输入类型上添加 Id 和 Class 属性。 当我添加以下示例时,它在输入类型上方的 SPAN 标记上应用 Id 和 Class [radio amount id:amou
我是一名优秀的程序员,十分优秀!