• Hello,

    I’m using the plugin to make a multi-dropdown taxonomies search. The first dropdown has categories with parent and child terms all showing inside this select field. I want to make child terms show under their parent terms by adding left padding. I added this code inside the foreach() in line 212 in /wp-query-search-filter.php file:

    if ( 0 == $term->parent )  {
    	$pad = '';
    	} else {
    		$pad = '   ';
    	}
    
    echo '<option value="'.$term->slug.'" '.$selected.' class="'.$class.'">'.$pad.' '.$term->name.'</option>';

    this adds left space to child terms, but the problem is all parent and child terms show in the ASC order. It doesn’t show child terms inside their parent terms.

    any help?

    https://www.ads-software.com/extend/plugins/wp-query-search-filter/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TC.K

    (@wp_dummy)

    Maybe you should try adding "orderby" => "slug" in line 206 (in the get terms function).

    Or you should see this this example .

    Hope this helps

    Thread Starter Sami kamal

    (@kumo99)

    ok I fixed it with this in line 206:

    $terms = get_terms($v['taxname'],'hide_empty='.$v['hide'].'&orderby=term_group');

    I think this should be in core plus the extra pad for child terms.

    thanks

    Plugin Author TC.K

    (@wp_dummy)

    @sami kamal,
    yep…will consider to add it in future upgrade.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to order a dropdown by parent terms?’ is closed to new replies.