WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
Is there a way to hide the children term's of each parent t (5 posts)

  1. AndrewMunro
    Member
    Posted 2 years ago #

    I have a taxonomy of "age", with parent terms of as age groups (18-25) and child terms (18,19,20,21,22,23,24,25) within each age group parent. I figured this would be a good way to have some sort of age range.

    In the actual dropdown that is displayed on the front-end, is there a way I could hide the children so it only displays the parent terms? So I only see 18-25.

    I tried using CSS to hide the level-1 class but it doesn't work so great with webkit browsers. Any have any ideas? thanks!

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

  2. AndrewMunro
    Member
    Posted 2 years ago #

    Hmm, perhaps a walker? I have no clue how to write one, but just reading through your code in walkers.php suggests this would be a possible solution. I'd need to just modify the "age" taxonomy somehow and remove the children from the dropdown.

  3. Alessandro Cardinali
    Member
    Posted 2 years ago #

    Hello.
    I am very interested in resolving this issue.
    How can I hide the children term's when they are not active?

  4. Alessandro Cardinali
    Member
    Posted 2 years ago #

    Ok ... I found a solution ... perhaps rudimentary but it works:)
    I edited the file "list-item.html" inside the folder "templates":

    <li class="term-item {{#is-selected}}current-term{{/is-selected}}">
    	{{#is-selected}}
    		<a class="remove-term" href="{{url}}" title="{{title}}">{{term-name}} ({{count}}) -</a>
    	{{/is-selected}}
    	{{^is-selected}}
    		<a class="add-term" href="{{url}}" title="{{title}}">{{term-name}} ({{count}}) +</a>
    	{{/is-selected}}
    	{{#is-selected}} <!-- Mod -->
    	{{#children}}
    		<ul>
    			{{{child-list}}}
    		</ul>
    	{{/children}}
    	{{/is-selected}} <!-- /Mod -->
    </li>
  5. lydiamunoz
    Member
    Posted 2 years ago #

    And do you know how can i hide the children terms if i am using dropdowns?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic