Display Selected Category in Published Request

While a buyer is filling out a request, one of the fields they fill out is a drop-down selection where they select one of the categories I’ve created in [WP Admin>>Hivepress>>Requests>>Categories].

They also fill out fields that I’ve created in [WP Admin>>HIvepress>>Requests>>Attributes].

I know how to make the fields created in [WP Admin>>HIvepress>>Requests>>Attributes] display in the request once it has been publicly published, by going to [Edit Attribute>>Display] and selecting “page(primary)”, however, I cannot seem to find where to make the chosen category display in the published request.

Where do I go to set that up and choose the position in which it displays in the published request. For example, for the attributes I created, I choose the “order” in which they display by putting a number in the “order” field of the attribute.

Or, alternatively, I need to know where or how to be able to hide/remove the “Category” field and make it not required.

For now, I’ve created another attribute that mirrors the Category field and have it displaying where I need it to… but the issue with this is when buyers are filling out the request form, they now have 2 identical “Category” fields to choose from so it’d redundant.

Thank You!

Hello any help here?

Thank you for waiting. Please try this PHP code snippet to hide and make a non-required default Category field. The other solutions require advanced customization.

add_filter(
	'hivepress/v1/models/request',
	function($args){
		
		if(isset($args['fields']['categories'])){
			$args['fields']['categories']['required'] = false;
			$args['fields']['categories']['display_type'] = 'hidden';
		}
		
		return $args;
	},
	1000
);

add_filter(
	'hivepress/v1/forms/request_submit',
	function($args){
		
		if(isset($args['fields']['categories'])){
			$args['fields']['categories']['required'] = false;
		}
		
		return $args;
	},
	1000
);
1 Like

Hi Yevhen,
This worked like a charm!
I was worried it would interfere with the categories field I had added for vendors but it didn’t.

Thanks again, Hivepress team!

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