<div class="form-option right"> <label for="city"><?php _e('City', 'framework'); ?> </label> <span class="selectwrap"> <select name="city" id="city" class="search-select"> <option selected="selected" value="-1"><?php _e('None', 'framework'); ?> </option> <?php /* Property City */ $property_city_terms = get_terms(array("property-city"), array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'parent' => 0)); generate_id_based_hirarchical_options("property-city", $property_city_terms, -1); ?> </select> </span> </div> <div class="form-option"> <label for="status"><?php _e('Status', 'framework'); ?> </label> <span class="selectwrap"> <select name="status" id="status" class="search-select"> <option selected="selected" value="-1"><?php _e('None', 'framework');
function edit_form_hierarchichal_options($property_id, $taxonomy_name) { $existing_term_id = 0; $tax_terms = get_the_terms($property_id, $taxonomy_name); if (!empty($tax_terms)) { foreach ($tax_terms as $tax_term) { $existing_term_id = $tax_term->term_id; break; } } $existing_term_id = intval($existing_term_id); if ($existing_term_id == 0 || empty($existing_term_id)) { echo '<option value="-1" selected="selected">' . __('None', 'framework') . '</option>'; } else { echo '<option value="-1">' . __('None', 'framework') . '</option>'; } $top_level_terms = get_terms(array($taxonomy_name), array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'parent' => 0)); generate_id_based_hirarchical_options($taxonomy_name, $top_level_terms, $existing_term_id); }