How to make conditional dropdown in wordpress?

by scotty_walker , in category: PHP CMS , a year ago

How to make conditional dropdown in wordpress?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by wilmer.lemke , a year ago

@scotty_walker 

To create a conditional dropdown in WordPress, you can follow these steps:

  1. Install and activate the "Conditional Fields for Contact Form 7" plugin from the WordPress Plugins directory.
  2. Create a new form or edit an existing one using Contact Form 7.
  3. Add a dropdown field to your form using the Contact Form 7 syntax. For example: [select select-1 "Option 1" "Option 2" "Option 3"]
  4. Add another dropdown field to your form using the Contact Form 7 syntax. For example: [select select-2 "Sub-option 1" "Sub-option 2" "Sub-option 3"]
  5. Select and wrap both dropdown fields with the [conditional] shortcode provided by the plugin. For example:
1
2
3
4
5
6
7
8
9
[conditional field="select-1" condition="Option 1"]
[select select-2 "Sub-option 1"]
[/conditional]
[conditional field="select-1" condition="Option 2"]
[select select-2 "Sub-option 2"]
[/conditional]
[conditional field="select-1" condition="Option 3"]
[select select-2 "Sub-option 3"]
[/conditional]


  1. You can repeat the above step to add more conditions and dropdown options as needed.
  2. Save or update your form.
  3. Use the shortcode of your form on the desired page or post in WordPress.


Now, when a user selects a particular option from the first dropdown, the second dropdown will dynamically change its options based on the selected value.

Related Threads:

How to make a button conditional in oracle forms?
How to make dropdown menu in tailwind css?
How to make a wordpress theme compatible with elementor?
How to make http request using php in wordpress plugin?
How to do a conditional router in koa?
How to implement conditional rendering in React?