I would like to change the type of field of categories in the filterable area for a select field. Additionally, I would like to change the text of the field, instead of “All categories” place “Browse by make”
Hi,
To change the type of field, please try this PHP snippet:
add_filter(
'hivepress/v1/forms/listing_filter',
function( $form_args, $form ) {
if(isset($form_args['fields']['_category'])){
$form_args['fields']['_category'] = array_merge(
$form_args['fields']['_category'],
[
'label' => 'Categories',
'type' => 'select',
'multiple' => true,
]
);
}
return $form_args;
},
1000,
2
);
To change the text of the field, please follow these instructions to translate any static text within HivePress, its themes, or extensions How to translate HivePress - HivePress Help Center.
Thanks this worked for me
Hi,
I was doing tests and in the frontend the field change to select but when I click on the filter button I get this error, when i inactivate the php snippet the button works fine, I await your comments
Hi,
Please try this PHP snippet:
add_filter(
'hivepress/v1/forms/listing_filter',
function( $form_args, $form ) {
if(isset($form_args['fields']['_category'])){
$form_args['fields']['_category'] = array_merge(
$form_args['fields']['_category'],
[
'label' => 'Categories',
'type' => 'select',
]
);
}
return $form_args;
},
1000,
2
);
If the error is still displayed, please send us the error logs.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.