public function _insertCustomPriceHoliday() { $complete = 1; if (TravelHelper::isset_table('st_holidays')) { global $wpdb; $table = $wpdb->prefix . $this->table; $sql = "\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tpost_id,\r\n\t\t\t\t\tadult_price,\r\n\t\t\t\t\tchild_price,\r\n\t\t\t\t\tinfant_price,\r\n\t\t\t\t\tcheck_in,\r\n\t\t\t\t\tcheck_out, type_holiday\r\n\t\t\t\tFROM\r\n\t\t\t\t\t{$wpdb->prefix}st_holidays\r\n\t\t\t\tWHERE\r\n\t\t\t\t\ttype_holiday = 'specific_date'"; $results = $wpdb->get_results($sql); if (is_array($results) && count($results)) { foreach ($results as $key => $val) { if (!empty($val->check_in) && !empty($val->check_out)) { $data = array('post_id' => $val->post_id, 'post_type' => 'st_holidays', 'check_in' => strtotime($val->check_in), 'check_out' => strtotime($val->check_out), 'number' => 1, 'adult_price' => floatval($val->adult_price), 'child_price' => floatval($val->child_price), 'infant_price' => floatval($val->infant_price), 'status' => 'available', 'groupday' => '1', 'priority' => 0); $insert = $wpdb->insert($table, $data); if (is_wp_error($insert)) { $complete = 0; break; } } } } } else { $complete = 0; } update_option('st_upgrade_availability', $complete); }