Forums Forums Search & Filter Pro Custom Taxonomy 'show all' checkbox

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #164552

    I have a list of terms from a custom taxonomy, with sub-cateogires listed underneath these as a checkbox. eg

    Cats []
    – Nice Cats []
    – Mean Cats []
    Dogs []
    – Big Dogs []
    – Little Dogs []

    I have stripped out the checkbox from the parent categories (‘Cats’, ‘Dogs’) and turned these into accordion drawers, so what I would like to do is have an ‘All <Parent cat name>’ option at the top of each subcat list like this.

    Cats
    – All Cats []
    – Nice Cats []
    – Mean Cats []
    Dogs
    – All Dogs []
    – Big Dogs []
    – Little Dogs []

    I do not see an option to achieve this anywhere and wondered if someone could point me in the right direction.

    Trevor
    #164572

    Do you have the Include Children in Parents option checked (ON)?

    Anonymous
    #164800

    I do, but I have found a solution using jQuery. I cloned the parent categories, and moved them into the .children list, wrapped them in a <li>, and prepended them with ‘All ‘ 🙂

    jQuery('.sf-level-0').each(function() {
    
    	jQuery(this).find('.sf-label-checkbox:first').clone().prependTo(jQuery(this).find('.children'));
    
    	jQuery(this).find('.sf-input-checkbox:first').prependTo(jQuery(this).find('.children'));
    
    	jQuery(this).find(".children .sf-input-checkbox:first").next().andSelf().wrapAll('<li>').prepend('All ');
    	
    });
    Trevor
    #164803

    Cool. Am I OK to close this thread?

    Anonymous
    #164805

    Yes. Thanks.

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