I'm using the following code to create a drop down box for a custom taxonomy search:
Functions code:
function get_terms_dropdown($taxonomies, $args){
$myterms = get_terms($taxonomies, $args);
$output ="<select name='TERM'>";
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='".$link."'>".$term_name." (".$term->count.") </option>";
}
$output .="</select>";
return $output;
}
PHP code (placed in a php widget):
<form action="<?php bloginfo('url'); ?>" method="get">
<div>
<?php
$taxonomies = array('TAXONOMY NAME');
$args = array('orderby'=>'name','hide_empty'=>true);
$select = get_terms_dropdown($taxonomies, $args);
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
<noscript><div><input type="submit" value="Term Value" /></div></noscript>
</div></form>
When a term is selected from the list it sends the user to a page with a URL output like: domain.com/?TERM=term1
How can i output this instead as: domain.com/TERM/term1
I also only want this to return posts from a specific custom post type - is there an extra bit of code i can add to get this functioning for post_type='xyz' ?
Thanks in advance,
Rob