
內容簡介
這個外掛會在「Contact Form 7」中加入一個模板函數,用以使用一個模板檔案。
這對主題開發人員來說很有用,可以順利檢查 CF7 標籤的顯示效果。
在主題資料夾中建立一個「atcf7」目錄,並將模板檔案(.php)放置在該目錄中。
您可以在模板檔案中使用 PHP、WordPress 函數/物件、ACF 函數(排除一些函數)。
但無法使用 PHP 顯示/隱藏表單標籤,以及新增/刪除必填標記(*)。
此外掛需要 Contact Form 7 ver5.5.3 或以上版本。
範例 [theme_path/atcf7/***.php]
<?php
if (!defined('ABSPATH')) {
exit;
}
/*
* Template Name: Distinguishing Name
*/
?>
<h2>
<?php
// WordPress 函數範例
the_title();
?>
</h2>
<table>
<tbody>
<tr>
<th><label for="your-category" onclick="">類別</label></th>
<td>
<?php
// ACF 的 get_field 函數與 checkbox 的範例
$cats = "'".get_field("cat1")."'";
$cats .= " '".get_field("cat2")."'";
$cats .= " '".get_field("cat3")."'";
?>
[checkbox your-category id:your-category class:atcf7-form-radio-label exclusive use_label_element <?php echo $cats; ?>]
</td>
</tr>
<tr>
<th><label for="your-name" onclick="">名稱</label></th>
<td>
[text* your-name id:your-name]
</td>
</tr>
<tr>
<th><label for="your-email" onclick="">電子郵件地址</label></th>
<td>
<div>
[email* your-email id:your-email ]
</div>
</td>
</tr>
<tr>
<th><label for="your-content" onclick="">內容</label></th>
<td>
[textarea* your-content x5 id:your-content ]
</td>
</tr>
</tbody>
</table>
<div>[submit "提交"]</div>
為了讓主題開發人員平滑進行確認,請在主題資料夾中建立 atcf7 目錄,並將模板檔案(.php)放置在該目錄中。
任意區段 1
外掛標籤
開發者團隊
② 後台搜尋「Add Template for Contact Form 7」→ 直接安裝(推薦)
原文外掛簡介
This plugin adds a template function to “Contact Form 7” using a template file.
This is useful for theme developers to smoothly check the display of CF7 tags.
Create an atcf7 directory in the theme folder and place the template file (.php) in that directory.
You can use PHP, WordPress functions / objects, ACF functions (excluding some) in the template file.
However, it is not possible to show / hide form tags and add / remove required mark(*) using PHP.
This plug-in requires Contact Form 7 ver5.5.3 or above.
Example [theme_path/atcf7/***.php]
|
[checkbox your-category id:your-category class:atcf7-form-radio-label exclusive use_label_element ] |
|
| [text* your-name id:your-name] | |
|
[email* your-email id:your-email ]
|
|
| [textarea* your-content x5 id:your-content ] |
For the theme developer to make the confirmation smooth, create the atcf7 directory in the theme folder and place the template file (.php) in that directory.
Arbitrary section 1
