首先要在functions.php
中放置以下代码
function cf7_select_dropdown($tag) {
if ( $tag['name'] != 'cf7-dropdown' )
return $tag;
$tag['raw_values'][] = "One";
$tag['labels'][] = "One";
$tag['raw_values'][] = "Two";
$tag['labels'][] = "Two";
$tag['raw_values'][] = "Three";
$tag['labels'][] = "Three";
$pipes = new WPCF7_Pipes($tag['raw_values']);
$tag['values'] = $pipes->collect_befores();
$tag['pipes'] = $pipes;
return $tag;
}
add_filter( 'wpcf7_form_tag', 'cf7_select_dropdown');
现在使用“ CF7-Dropdown”
[select cf7-dropdown]
,现在您将在下拉列表中看到自定义值。
您可以在联系表7 select中填充WooCommerce产品。访问此链接文章以获取更多详细信息
https://lets-solve.com/populate-woocommerce-products-in-contact-form-7-select/