Pokazivanje najviše opcije u kategorije

Kako prikazati jedino top-parent?

Imam sljedeći taxonomy:
-Kontinent
–Država
—Grad

-Kontinent
–Država
—Grad

-Kontinent
–Država
—Grad

-Kontinent
–Država
—Grad

imam u kodu zadano

<option value="'.$term->slug.'" value1=""

uspješno mi pokazuje na frontendu value="". Kako napraviti da uzme $term i pokaže njegov najviši parent

 function output_formtaxo_fields($type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass){
	$eid = explode(",", $exc);
	$args = array('hide_empty'=>$hide,'exclude'=>$eid );	
	$taxoargs = apply_filters('uwpqsf_taxonomy_arg',$args,$taxname,$formid);
    	$terms = get_terms($taxname,$taxoargs);
    $count = count($terms);
	 if($type == 'dropdown'){
		$html  = '<div class="'.$defaultclass.' '.$divclass.'" id="tax-select-'.$c.'"><span class="taxolabel-'.$c.'">'.$taxlabel.'</span>';
		$html .= '<input  type="hidden" name="taxo['.$c.'][name]" value="'.$taxname.'">';
		$html .= '<input  type="hidden" name="taxo['.$c.'][opt]" value="'.$opt.'">';
		$html .=  '<select id="tdp-'.$c.'" class="tdp-class-'.$c.'" name="taxo['.$c.'][term]">'; 
		if(!empty($taxall)){
			$html .= '<option selected value="uwpqsftaxoall">'.$taxall.'</option>';
		}
				if ( $count > 0 ){
					foreach ( $terms as $term ) {
					$selected = (isset($_GET['taxo'][$c]['term']) && $_GET['taxo'][$c]['term'] == $term->slug) ? 'selected="selected"' : ''; 							
				$html .= '<option value="'.$term->slug.'" value1=""  '.$selected.'>'.$term->name.'</option>';}
		}				
		$html .= '</select>';
		$html .= '</div>';
		return  apply_filters( 'uwpqsf_tax_field_dropdown', $html ,$type,$exc,$hide,$taxname,$taxlabel,$taxall,$opt,$c,$defaultclass,$formid,$divclass);
	}

Rješio preko

$term->description;

Ručno svakom term dajam naziv


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey