/ Published in: PHP
Place into fucntions.php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/******* CUSTOM CLINIC TAXONOMY DROPDOWN *********/ function get_terms_dropdown($taxonomies, $args){ $myterms = get_terms($taxonomies, $args); $firstitem = "<option value=\"\">Choose a clinic...</option><option value=\"about/providers\"><strong>* Show All Providers *</strong></option>"; $output ="<select name=\"clinic\" onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\" style=\"background:transparent;\"> $firstitem"; 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='clinic/".$link."'>".$term_name."</option>"; } $output .="</select>"; return $output; }