Permalink
Browse files

clean up

  • Loading branch information...
jtsternberg committed Mar 3, 2014
1 parent 7dfbda8 commit adb0ddf16b8c69e9d3dcd8e612c321f3ab3e7fa4
Showing with 8 additions and 9 deletions.
  1. +8 −9 helpers/cmb_Meta_Box_types.php
@@ -459,19 +459,18 @@ public static function wysiwyg( $field, $meta ) {
public static function taxonomy_select( $field, $meta, $object_id ) {
echo '<select name="', $field['id'], '" id="', $field['id'], '">';
- $names = self::get_object_terms( $object_id, $field['taxonomy'] );
- $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
- $taxonomyChosen = false;
+ $names = self::get_object_terms( $object_id, $field['taxonomy'] );
+ $terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
+ $has_term = false;
foreach ( $terms as $term ) {
if ( !is_wp_error( $names ) && !empty( $names ) && ! strcmp( $term->slug, $names[0]->slug ) ) {
echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>';
- $taxonomyChosen = true;
- }
- else if ( $taxonomyChosen == false && $term->slug == $field['default']) {
- echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>';
- }
- else {
+ $has_term = true;
+ }
+ else if ( ! $has_term == false && $term->slug == $field['default'] ) {
+ echo '<option value="' . $term->slug . '" selected>' . $term->name . '</option>';
+ } else {
echo '<option value="' . $term->slug . ' ' , $meta == $term->slug ? $meta : ' ' ,' ">' . $term->name . '</option>';
}
}

0 comments on commit adb0ddf

Please sign in to comment.