[WordPress] 外掛分享: Contact Form 7 – Repeatable Fields

首頁外掛目錄 › Contact Form 7 – Repeatable Fields
WordPress 外掛 Contact Form 7 – Repeatable Fields 的封面圖片
6,000+
安裝啟用
★★★★
4.3/5 分(21 則評價)
512 天前
最後更新
問題解決
WordPress 6.0+ PHP 7.2+ v2.0.2 上架:2018-03-18

內容簡介

這個外掛可以在 Contact Form 7 中新增可重複的欄位群組。

注意:已測試支援 Contact Form 7 5.1.6。

使用方式
表單頁簽

將想要的欄位用 [field_group your_group_id_here][/field_group] 包起來。短碼除了 WP 短碼格式,也接受 Contact Form 7 欄位參數格式的額外參數。

例如:

[field_group emails id="emails-groups" tabindex:1]
<label>你的電子信箱(必填)[email* your-email]</label>
[radio your-radio use_label_element default:1 "radio 1" "radio 2" "radio 3"]
[select* your-menu include_blank "option1" "option 2"]
[checkbox* your-checkbox "check 1" "check 2"]
[/field_group]

郵件頁簽

在郵件送出設定中,使用您的群組 ID 包裝欄位。您可以使用 [group_index] 標籤來列印群組索引,以及額外的 __<NUMBER> 來列印特定索引的欄位。

例如:

這個使用者輸入的第二個電子信箱是:[your-email__2]

這些是群組:
[emails]
群組 #[group_index]
核取方塊:[your-checkbox]
電子信箱:[your-email]
單選按鈕:[your-radio]
下拉選單:[your-menu]
[/emails]

新增和移除按鈕的客製化

你可以在你的佈景主題中新增過濾器來自訂新增和移除按鈕。

例如:

// In your theme's functions.php
function customize_add_button_atts( $attributes ) {
return array_merge( $attributes, array(
'text' => '新增條目',
) );
}
add_filter( 'wpcf7_field_group_add_button_atts', 'customize_add_button_atts' );

可用的過濾器有:

wpcf7_field_group_add_button_atts

過濾新增按鈕的屬性。

參數:
* $attributes:新增按鈕屬性的陣列,包含:
* additional_classes:要新增到按鈕的 CSS 類別
* text:按鈕上的文字

回傳值:按鈕屬性的陣列

wpcf7_field_group_add_button

過濾新增按鈕的 HTML。

參數:
* $html:預設新增按鈕的 HTML

回傳值:按鈕的 HTML

wpcf7_field_group_remove_button_atts

過濾刪除按鈕的屬性。

參數:
* $attributes:刪除按鈕屬性的陣列,包含:
* additional_classes:要新增到按鈕的 CSS 類別
* text:按鈕上的文字

回傳值:按鈕屬性的陣列

wpcf7_field_group_remove_button

過濾刪除按鈕的 HTML。

參數:
* $html:預設刪除按鈕的 HTML

回傳值:按鈕的 HTML

貢獻

您可以在GitHub 儲存庫中貢獻程式碼、問題和意見。

如果你喜歡這個外掛,請給個評價,謝謝🙂

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Contact Form 7 – Repeatable Fields」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin adds repeatable groups of fields to Contact Form 7.
NOTE: Tested with Contact Form 7 5.7.7.
Usage
Form tab
Wrap the desired fields with [field_group your_group_id_here][/field_group]. The shortcode accepts additional parameters, in WP shortcode format and in CF7 fields parameters format as well.
Example:
[field_group emails id="emails-groups" tabindex:1]

[radio your-radio use_label_element default:1 "radio 1" "radio 2" "radio 3"]
[select* your-menu include_blank "option1" "option 2"]
[checkbox* your-checkbox "check 1" "check 2"]
[/field_group]

Mail tab
In the mail settings, wrap the fields with your group id. You can use the [group_index] tag to print the group index and an additional __ to print a field at a specific index.
Example:
The second email entered by the user was: [your-email__2]

These were the groups:
[emails]
GROUP #[group_index]
Checkbox: [your-checkbox]
E-mail: [your-email]
Radio: [your-radio]
Select: [your-menu]
[/emails]

Check out the Wiki

Hooks available – How to customize the add and remove buttons
Frequently Asked Questions

Contribute
You can contribute with code, issues and ideas at the GitHub repository.
If you like the plugin, a review is appreciated 🙂

延伸相關外掛

文章
Filter
Apply Filters
Mastodon