public function get_type_day_of_week_day() { $day_of_week_index = $this->get_type_day_of_week_index(); $days_of_week = BYT_Theme_Utils::get_days_of_week(); if ($day_of_week_index > -1) { return $days_of_week[$day_of_week_index]; } return ''; }
function cruise_type_edit_meta_fields($term) { $days_of_week = BYT_Theme_Utils::get_days_of_week(); // put the term ID into a variable $t_id = $term->term_id; // retrieve the existing value(s) for this meta field. This returns an array $term_meta = get_option("taxonomy_{$t_id}"); ?> <tr class="form-field"> <th scope="row" valign="top"><label for="term_meta[cruise_type_is_repeated]"><?php _e('Is cruise repeated?', 'bookyourtravel'); ?> </label></th> <td> <select id="term_meta[cruise_type_is_repeated]" name="term_meta[cruise_type_is_repeated]" onchange="isCruiseTypeRepeatedChanged('table-row')"> <option <?php echo (int) $term_meta['cruise_type_is_repeated'] == 0 ? 'selected' : ''; ?> value="0"><?php _e('No', 'bookyourtravel'); ?> </option> <option <?php echo (int) $term_meta['cruise_type_is_repeated'] == 1 ? 'selected' : ''; ?> value="1"><?php _e('Daily', 'bookyourtravel'); ?> </option> <option <?php echo (int) $term_meta['cruise_type_is_repeated'] == 2 ? 'selected' : ''; ?> value="2"><?php _e('Weekdays', 'bookyourtravel'); ?> </option> <option <?php echo (int) $term_meta['cruise_type_is_repeated'] == 3 ? 'selected' : ''; ?> value="3"><?php _e('Weekly', 'bookyourtravel'); ?> </option> </select> <p class="description"><?php _e('Do cruises belonging to this cruise type repeat on a daily or weekly basis?', 'bookyourtravel'); ?> </p> </td> </tr> <tr id="tr_cruise_type_day_of_week" class="form-field" style="<?php echo (int) $term_meta['cruise_type_is_repeated'] < 3 ? 'display:none' : ''; ?> "> <th scope="row" valign="top"><label for="term_meta[cruise_type_day_of_week]"><?php _e('Start day (if weekly)', 'bookyourtravel'); ?> </label></th> <td> <select id="term_meta[cruise_type_day_of_week]" name="term_meta[cruise_type_day_of_week]"> <?php for ($i = 0; $i < count($days_of_week); $i++) { $day_of_week = $days_of_week[$i]; ?> <option <?php echo (int) $term_meta['cruise_type_day_of_week'] == $i ? 'selected' : ''; ?> value="<?php echo esc_attr($i); ?> "><?php echo $day_of_week; ?> </option> <?php } ?> </select> <p class="description"><?php _e('Select a start day of the week for weekly cruise', 'bookyourtravel'); ?> </p> </td> </tr> <?php }