Hi @nilssondigital
For the reset button, there is this code example with a shortcode [reset_filters_button]:
function reset_filters_button_shortcode() {
if( class_exists( 'FilterEverything\Filter\UrlManager' ) ){
$urlManager = new \FilterEverything\Filter\UrlManager();
$resetUrl = $urlManager->getResetUrl();
return '<button class="reset-filters-button"><a href="'.$resetUrl.'">Reset filters</a></button>';
}
return '';
}
add_shortcode('reset_filters_button', 'reset_filters_button_shortcode');
OR
To show the Reset button you can place the chips widget or shortcode [fe_chips] wherever you need and add the next example of CSS on the page with filtering.
You can add it for example via Filters -> Settings -> Experimental -> Custom CSS:
#wpc_chips_widget-2 .wpc-filter-chip:not(.wpc-chip-reset-all){
display: none;
}
Where #wpc_chips_widget-2 is the chips widget wrapper and it may be different in your case. You can find it in HTML code. In general, this code hides all chips except the Reset button. But it will appear only when you apply some filters.
There is no such possibility the filter is working only with the URL with the addition of URL prefixes, and it should remove the URL in order to remove all of the filters. Basically use the current page URL without all of those adiitions from filtering.
Best Regards – Victor
Ah that’s perfect – I had no idea that’s what ‘Chips’ was. Kept seeing it referenced and tried looking it up bit didn’t know that is exactly what I needed. Thank you!
One side note that would be helpful for those – I have several radio fields that are just ‘yes/no’ responses (true/false doesn’t work because I have to return the output somewhere else and it always comes out as 1/0), but an option to include the title for those so I know WHAT is yes or no…would be helpful. Very small request and I’m using this anyways so thank you!
Hi @nilssondigital
If you need to add in chips some data to the values, you can use this simple code example:
// Define the callback function for the 'wpc_chips_term_name' filter hook
function modify_chips_term_name($term_name, $term, $filter) {
$term_id = $term->term_id;
if($term_id === 'min__price') {
return $modified_term_name = $term_name . ' $';
}
if($term_id === 'max__price') {
return $modified_term_name = $term_name . ' $';
}
return $term_name;
}
// Hook the callback function to the 'wpc_chips_term_name' filter hook
add_filter('wpc_chips_term_name', 'modify_chips_term_name', 10, 3);
Best Regards – Victor
That’s amazing thank you so much!
One last question, not really related so can open a different ticket for it – is there plans for the Search function to support custom fields (ACF)? Right now it doesn’t seem to search that content, and based on what I read on the documentation it supports post content, title and taxonomies? This would be a GAME changer, as most of the data/posts I’m filtering through is based on custom fields.
Thanks!
Hi @nilssondigital
Yes, the development team has big plans for future updates in order to extend the search capabilities. We do not have any date on our hands when it can happen but we know that there are such plans.
Currently, it is searching in the post title, content, short description, and SKU of Woo products.
Best Regards – Victor