Select Box for WP Alchemy/Taxonomy


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



Copy this code and paste it in your HTML
  1. <?php $selected = ' selected="selected"'; ?>
  2. <select name="<?php $metabox->the_name(); ?>">
  3. <?php $terms = get_terms('property-location', 'orderby=name&hide_empty=0');
  4. foreach ($terms as $taxindex => $taxitem) {
  5. echo '<option value="'. $taxitem->ID .'"'; $thevalue = $taxitem->ID; if ($metabox->get_the_value() == "$thevalue") echo $selected; ?>
  6. <?php echo '>' . $taxitem->name .'</option>';
  7. }
  8. ?>
  9. </select>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.