With this hook it is possible to add a new filter element.
For example, you need to insert some text or html into the filter form:
add_filter('avalon23_extend_filter_fields', function( $available_fields, $filter_id ) {
$available_fields['my_example'] = [
'title' => esc_html__('An Example', 'avalon23-products-filter'),
'options' => [],
'get_draw_data' => function($filter_id) {
$res['view']= 'html';
$res['html']= base64_encode ('<p>Show some text OR HTML !!!</p>');
$res['width_sm'] = avalon23()->filter_items->get_by_field_key($filter_id, 'my_example')['width_sm'];
$res['width_md'] = avalon23()->filter_items->get_by_field_key($filter_id, 'my_example')['width_md'];
$res['width_lg'] = avalon23()->filter_items->get_by_field_key($filter_id, 'my_example')['width_lg'];
return $res;
},
'get_query_args' => function($args, $value) {
return $args;
}
];
return $available_fields;
}, 99, 2);
as a result you will see

If you need to add a setting for this custom element read this article.


