Forums Forums Search & Filter Pro Hide child taxomony in Hierarchical

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #15529

    Hi,
    I am using this plugin for woocommerce product categories. I want to know is possible to keep child taxomony terms underneath parent taxomony hidden unless hovered over or when clicked on parent taxomony.

    Thanks

    Anonymous
    #15709

    Hi Jay,

    I had the same need and was only able to solve it by hacking the plugin slightly in order to move the inputs to *before* the labels – the plugin by default ‘wraps’ the inputs with the label tag, because this is now considered semantically correct and more desirable for most styling purposes, however it leaves you unable to use the checked/unchecked state to hide/show child inputs.

    I don’t recommend doing this unless you’re very familiar with code-hacking, and if you decide to you should be sure to back up the file just in case you have to revert, but the file I modified is in the plugin’s /public/includes/ folder named class-search-filter-taxonomy-walker.php.

    After the labels are modified to follow the inputs instead of wrapping them, you’ll still need to modify your CSS file to have the labels appear inline with the checkboxes, and then to do the show/hide based on the checked/unchecked state of the parent taxonomy…..here is what I added to my own CSS file:

    form.searchandfilter li label {display:inline;}
    form.searchandfilter li ul li ul li {font-size:80%;}
    form.searchandfilter ul.children { display: none; }
    form.searchandfilter input:checked ~ ul.children {display: block;border-bottom:1px solid #ccc;}

    I did mention this to Ross and he may consider making this an option in a future release (wrapping the inputs inside the label tags or not). I hope this helps!

Viewing 2 posts - 1 through 2 (of 2 total)