Example with Two Drop-down Menu Shorcode:
1) [select menu-569 include_blank “One ” “Two ” “Three”]
2) [select menu-614 include_blank “abc ” “xyz ” “atz”]
Add Below Code in functions.php file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
function help4cms_wpcf7_form_elements($html) { function help4cms_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); } } help4cms_replace_include_blank('menu-569', 'Choose Payment Method', $html); // Chnage here your dropdown menu ID help4cms_replace_include_blank('menu-614', 'Choose Number of Tickets', $html); // Chnage here your dropdown menu ID return $html; } add_filter('wpcf7_form_elements', 'help4cms_wpcf7_form_elements'); |
I used this but it breaks down page content.There might be some mistake.It replaces the text but after the page is not displaying.
Hi Pratik,
I think You did some mistake , because this code is already tested.
yes it is not working
Hi Aarzoo,
I think You did some mistake, Use this code like as :
Shortcode of Select Drop-down Menu:[select menu-621 include_blank “One ” “Two ” “Three”]
Use Below Code In functions.php file:
Use this [select* menu-206 first_as_label “Select doctor” “David Mikaberidze” “Sophio Gelashvili” “Maya Dolidze”]
Hi Aarzoo,
I think You did some mistake, Use this code like as :
Shortcode of Select Drop-down Menu:[select menu-621 include_blank “One ” “Two ” “Three”]
Use Below Code In functions.php file:
thankyou Mudit
Thank you Mudit !! Its working perfectly..
Thanks for your code, instructions in code comments… Its help a lot..