Search Add-on: Adding additional fields to the search form

Documentation Menu

Search Add-on: Adding additional fields to the search form

The Search Add-on supports adding additional fields to the search form. These fields are created by adding a custom code snippet in your theme’s functions.php file.

Example #1 – filter by meta values

You can create a new field that filters calendars based on a custom meta values from the post assigned to the calendar. You can use the $data[‘post_id’] variable to get the meta value.

Example #2 – filter by calendar id/location

You can use the additional search field to display different calendars based on the field’s value. In the example below, if “City” is selected, only calendars 1, 2 and 3 will be returned if the dates are available. If “Beach” is selected, calendars 4, 5 and 6 will be returned.

Please note that the code provided is just a sample to explain the functionality, you will need to adapt this code to work with your website setup.

Was this article helpful?

Yes (1) No

We're sorry to see this article wasn't as helpful as we hoped it would be. Please let us know what you were looking for so that we can improve this documentation page.

Is WP Booking System a good fit for you?

Tell us about your business activity & plugin requirements and we'll let you know if WP Booking System is right for you.

Have a support question? Please use this form instead.