Support » Plugin: Beautiful taxonomy filters » Filter without Button

  • Resolved lschuerg

    (@lschuerg)


    Hey, is it possible to automatic filter when you choose a taxonomy, without the need to click on apply button?

    Thanks a lot,
    Laszlo

Viewing 3 replies - 1 through 3 (of 3 total)
  • This definitely is something I would be interested in too.

    eqhes

    (@davidcs66)

    Surely you solved this, but in case anyone else is looking for how to do this:

    1) Create a custom.js file inside your theme folder with this code (remember to change IDs with your own):

    
    jQuery(document).ready(function(){
    	
    	jQuery('#your_select2_select_id').on('select2:select', function (evt) {
    		jQuery('#your_select2_form_id').submit();
    	});
    
    });
    

    2) Load custom.js from your functions.php like this:

    
    add_action( 'wp_enqueue_scripts', 'my_custom_script_load' );
    function my_custom_script_load(){
      wp_enqueue_script( 'my-custom-script', get_stylesheet_directory_uri() . '/custom.js', array( 'jquery' ) );
    }
    

    3) Hide the “apply filters” button within your style.css file or the custom CSS box in the plugin’s control panel:

    
    .beautiful-taxonomy-filters-button {
    	display: none;
    }
    

    4) Enjoy! 😉

    Plugin Author Jonathandejong

    (@jonathandejong)

    Thank you Eqhes for the short tutorial.
    I will not implement this option in core (at least not in the basic version) since it essentially means you have to load the page with each selection which would only really make sense if you have but 1 taxonomy. And in that case you’d might as well use wp_dropdown_categories right in the theme.

    Should perhaps also note that anyone using the code above have to change the “#your_select2_select_id” in the jquery selector.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter without Button’ is closed to new replies.