Reorder Search Fields

Reorder how the Availability Search fields can be done with the below PHP snippet. You can move any of the field lines above or below each field line inside the array. The first line e.g the date search field will be displayed first and the submit button last.

We recommend copying the code snippet into your themes function.php file, or better yet a custom plugin.

/** * Reorder the Availability Search fields for the frontend search. * * @param [type] $fields * @param [type] $attributes * @return void */ function custom_aswb_search_field_order( $fields, $attributes ) { $new_order = array( 'date' => $fields['date'], // Move the whole line before or after each to reorder. 'categories' => $fields['categories'], 'taxonomies' => $fields['taxonomies'], 'keyword' => $fields['keyword'], 'submit' => $fields['submit'], ); return $new_order; } add_filter( 'aswb_filter_form_fields', 'custom_aswb_search_field_order', 10, 2 );
Code language: PHP (php)
Was this page helpful?