Make the filter order not changing.

[ad_1]

Plugin Contributor
ghoul

(@sachyya-sachet)

Hello @mauricevieth89

Hope you are doing well.

To make the filter items’ order not to change when clicked, you can pass a sortBy parameter to it. For that you can add the below code in your child theme’s functions.php:

<?php
function your_theme_slug_facet_modifications( $facet_settings, $facet ) {
     $facet_settings = [
         'sortBy' => ['name'],
     ];

     return $facet_settings;
 }

 add_filter( 'cm_typesense_search_facet_settings', 'your_theme_slug_facet_modifications', 10, 2 );

It would need some extra customization to make it look like radio buttons. But you can make it behave like the radio button by changing the refinement type to menu with the code below:

<?php
function yout_theme_slug_change_filter_type( $filter, $post_type ) {
	$filter="menu";
	return $filter;
}

add_filter( 'cm_typesense_filter_type', 'yout_theme_slug_change_filter_type', 10, 2 );

Hope this helps. Please let us know if you need further assistance.

Regards

 

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