Reset filters button? | WordPress.org

[ad_1]

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

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer