Posted By

jamiebrwr on 08/13/10


Tagged

wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jamalmohamed


Custom Clinic Taxonomy Dropdown


 / Published in: PHP
 

Place into fucntions.php

  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
Posted By: fjarrett on August 22, 2010

Then call this function in your template...

Posted By: fjarrett on August 22, 2010

[code]

Posted By: fjarrett on August 22, 2010

You need to login to post a comment.