Custom Clinic Taxonomy Dropdown


/ Published in: PHP
Save to your folder(s)

Place into fucntions.php


Copy this code and paste it in your HTML
  1. /******* CUSTOM CLINIC TAXONOMY DROPDOWN *********/
  2.  
  3. function get_terms_dropdown($taxonomies, $args){
  4. $myterms = get_terms($taxonomies, $args);
  5. $firstitem = "<option value=\"\">Choose a clinic...</option><option value=\"about/providers\"><strong>* Show All Providers *</strong></option>";
  6. $output ="<select name=\"clinic\" onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\" style=\"background:transparent;\">
  7. $firstitem";
  8. foreach($myterms as $term){
  9. $root_url = get_bloginfo('url');
  10. $term_taxonomy=$term->taxonomy;
  11. $term_slug=$term->slug;
  12. $term_name =$term->name;
  13. $link = $term_slug;
  14. $output .="<option value='clinic/".$link."'>".$term_name."</option>";
  15. }
  16. $output .="</select>";
  17. return $output;
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.