I have been looking for hours for an example on how to do this. I have 2 simple taxonomies, Type, Size. I need to create a custom form with the 2 taxonomies available as Select list/filter.
Please help!
tx in advance
<form role="search" method="get" id="searchform" action="<?php bloginfo('home'); ?>">
<input type="text" value="" name="s" id="s" />
<?php
function get_terms_dropdown($taxonomies, $selectname,$args){
$myterms = get_terms($taxonomies, $args);
$selected = "selected";
$output ="<select name='".$selectname."'><option selected='".$selected."'>Select</option>'";
foreach($myterms as $term){
//$term_taxonomy=$term->$taxonomies;
$term_slug=$term->slug;
$term_name =$term->name;
$output .="<option value='".$term_slug."'>".$term_name."</option>";
}
$output .="</select>";
return $output;
}
$taxonomies = array('location');
$taxonomies2 = array('function');
$taxonomies3 = array('sector');
$args = array('order'=>'ASC','hide_empty'=>false);
echo "<br />".get_terms_dropdown($taxonomies,'location' ,$args)."<br />";
echo get_terms_dropdown($taxonomies2,'function' ,$args)."<br />";
echo get_terms_dropdown($taxonomies3, 'sector' ,$args)."<br />";
?>
<input type="submit" id="searchsubmit" value="Search" />
</form>