Hi! I have a custom taxonomy named 'ubicacion', is hhierarchical and I have something like this:
Guatemala
-Guatemala City
-Mixco
- ....
Sacatepequez
-Antigua
-Another item
-...
And so on, but I need just to list (in a select field) just the parents, I mean first level (guatemala, sacatepequez, etc).
I'm using get_terms(); And this function:
function get_terms_dropdown($taxonomies, $args){
$myterms = get_terms($taxonomies, $args);
$output ="<select name='".$taxonomies."'>";
foreach($myterms as $term){
$root_url = get_bloginfo('url');
$term_taxonomy=$term->taxonomy;
$term_slug=$term->slug;
$term_name =$term->name;
$link = $term_slug;
$output .="<option value='".$term_name."'>".$term_name."</option>";
}
$output .="</select>";
return $output;
}
Any can help me please