It is better to change the default ---
without hacking the plugin php files.
Add one of the following solutions to your functions.php
:
Simple solution: Replace all ---
in all forms with the same Please select...
text:
function my_wpcf7_form_elements($html) {
$text = 'Please select...';
$html = str_replace('<option value="">---</option>', '<option value="">' . $text . '</option>', $html);
return $html;
}
add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');
Complex solution: Replace ---
of known select elements with a different text each, you need the names like menu-569
from [select menu-569 include_blank ...]
shortcode for this:
function my_wpcf7_form_elements($html) {
function ov3rfly_replace_include_blank($name, $text, &$html) {
$matches = false;
preg_match('/<select name="' . $name . '"[^>]*>(.*)<\/select>/iU', $html, $matches);
if ($matches) {
$select = str_replace('<option value="">---</option>', '<option value="">' . $text . '</option>', $matches[0]);
$html = preg_replace('/<select name="' . $name . '"[^>]*>(.*)<\/select>/iU', $select, $html);
}
}
ov3rfly_replace_include_blank('menu-569', 'Choose language', $html);
ov3rfly_replace_include_blank('menu-614', 'Choose country', $html);
return $html;
}
add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');