How do I include Vendor's name in search?

At the moment when I try to search a vendor’s name on the search bar, it only shows the listings by the vendors and not the vendor itself.
Is there a possibility to include the vendor’s name in search too?

Hi, if you have a vendors page set up…Then under hivepress/vendors, look for search, and put keywords.

Then when you enter the vendors name in the keywords, in the search bar, in the vendor’s page, it should search by the name.

1 Like

If you mean searching vendors instead of listings, please use the Vendor Search Form instead of the listing one. If you mean showing the vendor name/link in the listing block, there’s no such element in ListingHive but we have this in a few other themes (e.g. ExpertHive or TaskHive), in ListingHive it’s also possible but requires customizations Adding vendor links to the listing block footer

Is there a way to include Vendor in the Listing Search Form?
I’m using the ExpertHive theme.

Also, is there a way to hide a Listing Category from the Listing Search Form? meaning a list of listings from a particular category cannot be found when search

I don’t think you can without further developer customization. But maybe u can copy and paste the vendor’s html code on the same page as a solution.

add_filter(
	'hivepress/v1/models/listing/fields',
	function($fields, $model){
		$disabled_categories_ids = [1,2,3];
		
		if(isset($fields['categories']['options'])){
			foreach($disabled_categories_ids as $category_id){
				unset($fields['categories']['options'][$category_id]);
			}	
		}
		
		return $fields;
	},
	10000,
	2
);

Use the code above to hide categories. Substitute the 1, 2, 3 for each listing category ID you will like to have hidden. But im not sure if this code snippet hides it in the add listing section or in general.

You can find the category IDs on the top browser when in the edit category back end (they are just the numbers in between all the text in that url).

1 Like

If you mean searching both vendors and listings using the same form unfortunately there’s no such option because the vendor block and listing block have different layouts, and mixing different types of content would also mix search filters, categories etc. By default, vendors and their listings are separate entities in HivePress, both vendors and listings have their own categories and search forms.

Please let me know if you mean restricting search by specific categories, or removing them from selection when a new listing is being added?

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