Add Category Checkboxes to Listing Search Form

I’m wondering if there’s a way to add category checkboxes to the main Listing Search widget. We’re just going to develop the site using Gutenberg / Block Editor and the client would like more than just Location and Keyword fields in the main listing search.

It’s for a stylist directory so there’s only going to be two categories. Salons and Stylists. So you should be able to search for just stylists, just salons or obviously both which would be the default.

Please try to add Categories option in Default fields setting in HivePress/Settings/Listings/Search section

That’s cool. I just tried it. Any chance it can be checkboxes instead?

Unfortunately, it is not possible for the Categories field as it causes some functionality problems.

But it is possible to show it as a radio field. Also, please note that it can require further customization

add_filter(
	'hivepress/v1/forms/listing_search',
	function( $form ) {
		
		if(isset($form['fields']['_category'])){
			$form['fields']['_category']['type'] = 'radio';
		}
		
		return $form;
	},
	1000
);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.