How change class in input location field

Hi, I have question. I would like to change css class in input search location. I trying, but i dont know, what i doing bad.

add_filter(
	'hivepress/v1/forms/listing_search',
	function( $form ) {
		if ( isset( $form['fields']['location']) ) {
			$form['fields']['location']['attributes']['class']  = array_merge($form['fields']['location']['attributes']['class'], ['form-control width-100%']);
		}else{
			$form['fields']['location']['attributes']['class'] = ['form-control width-100% margin-y-sm margin-y-0@md'];
		}

		return $form;
	},
	1000
);

Please try this PHP snippet instead

add_filter(
	'hivepress/v1/forms/listing_search',
	function( $form ) {
		if ( isset( $form['fields']['location']['attributes']) ) {
			$form['fields']['location']['attributes']['class']  = array_merge($form['fields']['location']['attributes']['class'], ['form-control width-100%']);
		}else{
			$form['fields']['location']['attributes']['class'] = ['form-control width-100% margin-y-sm margin-y-0@md'];
		}

		return $form;
	},
	1000
);


Thanks for help! But I have still problem.
Before, I trying your idea but, this insert class to div, but I would like to insert in input tag.

Unfortunately, there is no simple snippet. But you can get this input to add CSS properties with class, for example, .form-control input

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