global $search_max_rooms, $search_max_adults, $search_max_kids; get_header(); if (have_posts()) { while (have_posts()) { the_post(); //init variables $acc_id = get_the_ID(); $acc_meta = get_post_meta($acc_id); $acc_meta['review'] = get_post_meta(trav_acc_org_id($acc_id), 'review', true); $acc_meta['review_detail'] = get_post_meta(trav_acc_org_id($acc_id), 'review_detail', true); $tm_data = get_post_meta($acc_id, 'trav_accommodation_tm_testimonial', true); $accommodation_type = wp_get_post_terms($acc_id, 'accommodation_type'); $args = array('post_type' => 'room_type', 'posts_per_page' => -1, 'meta_query' => array(array('key' => 'trav_room_accommodation', 'value' => array($acc_id))), 'suppress_filters' => 0); $room_types = get_posts($args); $city = trav_acc_get_city($acc_id); $country = trav_acc_get_country($acc_id); $facilities = wp_get_post_terms($acc_id, 'amenity'); $things_to_do = empty($acc_meta['trav_accommodation_ttd']) ? '' : $acc_meta['trav_accommodation_ttd']; // init map & gallery & calendar variables $gallery_imgs = array_key_exists('trav_gallery_imgs', $acc_meta) ? $acc_meta['trav_gallery_imgs'] : array(); $map = empty($acc_meta['trav_accommodation_loc']) ? '' : $acc_meta['trav_accommodation_loc'][0]; $calendar_desc = empty($acc_meta['trav_accommodation_calendar_txt']) ? '' : $acc_meta['trav_accommodation_calendar_txt'][0]; $show_gallery = 0; $show_map = 0; $show_street_view = 0; $show_calendar = 0; if (array_key_exists('trav_accommodation_main_top', $acc_meta)) { $main_top_meta = $acc_meta['trav_accommodation_main_top']; $show_gallery = in_array('gallery', $main_top_meta) ? 1 : 0; $show_map = in_array('map', $main_top_meta) ? 1 : 0;
function trav_acc_send_confirmation_email($booking_no, $booking_pincode, $type = 'new', $subject = '', $description = '') { global $wpdb, $logo_url, $trav_options; $booking_data = trav_acc_get_booking_data($booking_no, $booking_pincode); if (!empty($booking_data)) { // server variables $admin_email = get_option('admin_email'); $home_url = esc_url(home_url()); $site_name = $_SERVER['SERVER_NAME']; $logo_url = esc_url($logo_url); $acc_book_conf_url = trav_acc_get_book_conf_url(); $booking_data['accommodation_id'] = trav_acc_clang_id($booking_data['accommodation_id']); $booking_data['room_type_id'] = trav_room_clang_id($booking_data['room_type_id']); // accommodation info $accommodation_name = get_the_title($booking_data['accommodation_id']); $accommodation_url = esc_url(trav_get_permalink_clang($booking_data['accommodation_id'])); $accommodation_thumbnail = get_the_post_thumbnail($booking_data['accommodation_id'], 'list-thumb'); $accommodation_address = get_post_meta($booking_data['accommodation_id'], 'trav_accommodation_address', true); $accommodation_city = trav_acc_get_city($booking_data['accommodation_id']); $accommodation_country = trav_acc_get_country($booking_data['accommodation_id']); $accommodation_phone = get_post_meta($booking_data['accommodation_id'], 'trav_accommodation_phone', true); $accommodation_email = get_post_meta($booking_data['accommodation_id'], 'trav_accommodation_email', true); $accommodation_room_name = esc_html(get_the_title($booking_data['room_type_id'])); if (empty($accommodation_address)) { $accommodation_address = $accommodation_city . ' ' . $accommodation_country; } $check_in = get_post_meta($booking_data['accommodation_id'], 'trav_accommodation_check_in', true); $check_out = get_post_meta($booking_data['accommodation_id'], 'trav_accommodation_check_out', true); $check_in_time = empty($check_in) ? $booking_data['date_from'] : $booking_data['date_from'] . ' ' . $check_in; $check_out_time = empty($check_out) ? $booking_data['date_to'] : $booking_data['date_to'] . ' ' . $check_out; // booking info $booking_no = $booking_data['booking_no']; $booking_pincode = $booking_data['pin_code']; $date_from = new DateTime($booking_data['date_from']); $date_to = new DateTime($booking_data['date_to']); $number1 = $date_from->format('U'); $number2 = $date_to->format('U'); $booking_nights = ($number2 - $number1) / (3600 * 24); $booking_checkin_time = date('l, F, j, Y', trav_strtotime($booking_data['date_from'])); $booking_checkout_time = date('l, F, j, Y', trav_strtotime($booking_data['date_to'])); $booking_rooms = $booking_data['rooms']; $booking_adults = $booking_data['adults']; $booking_kids = $booking_data['kids']; $booking_room_price = esc_html(trav_get_price_field($booking_data['room_price'] * $booking_data['exchange_rate'], $booking_data['currency_code'], 0)); $booking_tax = esc_html(trav_get_price_field($booking_data['tax'] * $booking_data['exchange_rate'], $booking_data['currency_code'], 0)); $booking_total_price = esc_html(trav_get_price_field($booking_data['total_price'] * $booking_data['exchange_rate'], $booking_data['currency_code'], 0)); $booking_deposit_price = esc_html($booking_data['deposit_price'] . $booking_data['currency_code']); $booking_deposit_paid = esc_html(empty($booking_data['deposit_paid']) ? 'No' : 'Yes'); $booking_update_url = esc_url(add_query_arg(array('booking_no' => $booking_data['booking_no'], 'pin_code' => $booking_data['pin_code']), $acc_book_conf_url)); // customer info $customer_first_name = $booking_data['first_name']; $customer_last_name = $booking_data['last_name']; $customer_email = $booking_data['email']; $customer_country_code = $booking_data['country_code']; $customer_phone = $booking_data['phone']; $customer_address = $booking_data['address']; $customer_city = $booking_data['city']; $customer_zip = $booking_data['zip']; $customer_country = $booking_data['country']; $customer_special_requirements = $booking_data['special_requirements']; $variables = array('home_url', 'site_name', 'logo_url', 'accommodation_name', 'accommodation_url', 'accommodation_thumbnail', 'accommodation_country', 'accommodation_city', 'accommodation_address', 'accommodation_phone', 'accommodation_email', 'accommodation_room_name', 'booking_no', 'booking_pincode', 'booking_nights', 'booking_checkin_time', 'booking_checkout_time', 'booking_rooms', 'booking_adults', 'booking_kids', 'booking_room_price', 'booking_tax', 'booking_total_price', 'booking_deposit_price', 'booking_deposit_paid', 'booking_update_url', 'customer_first_name', 'customer_last_name', 'customer_email', 'customer_country_code', 'customer_phone', 'customer_address', 'customer_city', 'customer_zip', 'customer_country', 'customer_special_requirements'); if (empty($subject)) { if ($type == 'new') { $subject = empty($trav_options['acc_confirm_email_subject']) ? 'Booking Confirmation Email Subject' : $trav_options['acc_confirm_email_subject']; } elseif ($type == 'update') { $subject = empty($trav_options['acc_update_email_subject']) ? 'Booking Updated Email Subject' : $trav_options['acc_update_email_subject']; } elseif ($type == 'cancel') { $subject = empty($trav_options['acc_cancel_email_subject']) ? 'Booking Canceled Email Subject' : $trav_options['acc_cancel_email_subject']; } } if (empty($description)) { if ($type == 'new') { $description = empty($trav_options['acc_confirm_email_description']) ? 'Booking Confirmation Email Description' : $trav_options['acc_confirm_email_description']; } elseif ($type == 'update') { $description = empty($trav_options['acc_update_email_description']) ? 'Booking Confirmation Email Description' : $trav_options['acc_update_email_description']; } elseif ($type == 'cancel') { $description = empty($trav_options['acc_cancel_email_description']) ? 'Booking Confirmation Email Description' : $trav_options['acc_cancel_email_description']; } } foreach ($variables as $variable) { $subject = str_replace("[" . $variable . "]", ${$variable}, $subject); $description = str_replace("[" . $variable . "]", ${$variable}, $description); } if (!empty($trav_options['acc_confirm_email_ical']) && $type == 'new') { $mail_sent = trav_send_ical_event($site_name, $admin_email, $customer_first_name . ' ' . $customer_last_name, $customer_email, $check_in_time, $check_out_time, $subject, $description, $accommodation_address); } else { $mail_sent = trav_send_mail($site_name, $admin_email, $customer_email, $subject, $description); } /* mailing function to business owner */ $bowner_address = ''; if (!empty($trav_options['acc_booked_notify_bowner'])) { if ($type == 'new') { $subject = empty($trav_options['acc_bowner_email_subject']) ? 'You received a booking' : $trav_options['acc_bowner_email_subject']; $description = empty($trav_options['acc_bowner_email_description']) ? 'Booking Details' : $trav_options['acc_bowner_email_description']; } elseif ($type == 'update') { $subject = empty($trav_options['acc_update_bowner_email_subject']) ? 'A booking is updated' : $trav_options['acc_update_bowner_email_subject']; $description = empty($trav_options['acc_update_bowner_email_description']) ? 'Booking Details' : $trav_options['acc_update_bowner_email_description']; } elseif ($type == 'cancel') { $subject = empty($trav_options['acc_cancel_bowner_email_subject']) ? 'A booking is canceled' : $trav_options['acc_cancel_bowner_email_subject']; $description = empty($trav_options['acc_cancel_bowner_email_description']) ? 'Booking Details' : $trav_options['acc_cancel_bowner_email_description']; } foreach ($variables as $variable) { $subject = str_replace("[" . $variable . "]", ${$variable}, $subject); $description = str_replace("[" . $variable . "]", ${$variable}, $description); } if (!empty($accommodation_email)) { $bowner_address = $accommodation_email; } else { $post_author_id = get_post_field('post_author', $booking_data['accommodation_id']); $bowner = get_user_by('id', $post_author_id); if (!empty($bowner)) { $bowner_address = $bowner->user_email; } } if (!empty($bowner_address)) { trav_send_mail($site_name, $admin_email, $bowner_address, $subject, $description); } } /* mailing function to admin */ if (!empty($trav_options['acc_booked_notify_admin'])) { if ($bowner_address != $admin_email) { if ($type == 'new') { $subject = empty($trav_options['acc_admin_email_subject']) ? 'You received a booking' : $trav_options['acc_admin_email_subject']; $description = empty($trav_options['acc_admin_email_description']) ? 'Booking Details' : $trav_options['acc_admin_email_description']; } elseif ($type == 'update') { $subject = empty($trav_options['acc_update_admin_email_subject']) ? 'A booking is updated' : $trav_options['acc_update_admin_email_subject']; $description = empty($trav_options['acc_update_admin_email_description']) ? 'Booking Details' : $trav_options['acc_update_admin_email_description']; } elseif ($type == 'cancel') { $subject = empty($trav_options['acc_cancel_admin_email_subject']) ? 'A booking is canceled' : $trav_options['acc_cancel_admin_email_subject']; $description = empty($trav_options['acc_cancel_admin_email_description']) ? 'Booking Details' : $trav_options['acc_cancel_admin_email_description']; } foreach ($variables as $variable) { $subject = str_replace("[" . $variable . "]", ${$variable}, $subject); $description = str_replace("[" . $variable . "]", ${$variable}, $description); } trav_send_mail($site_name, $admin_email, $admin_email, $subject, $description); } } return true; } return false; }
function trav_acc_get_acc_list_sigle($acc_id, $list_style, $before_article = '', $after_article = '', $show_badge = false, $animation = '') { echo wp_kses_post($before_article); // $acc_id = trav_acc_clang_id( $acc_id ); $avg_price = get_post_meta($acc_id, 'trav_accommodation_avg_price', true); $review = get_post_meta($acc_id, 'review', true); $review = !empty($review) ? round($review, 1) : 0; $brief = get_post_meta($acc_id, 'trav_accommodation_brief', true); if (empty($brief)) { $brief = apply_filters('the_content', get_post_field('post_content', $acc_id)); $brief = wp_trim_words($brief, 20, ''); } $loc = get_post_meta($acc_id, 'trav_accommodation_loc', true); $discount_rate = get_post_meta($acc_id, 'trav_accommodation_discount_rate', true); if ($list_style == "style1" || $list_style == "style2") { ?> <article class="box"> <figure <?php echo wp_kses_post($animation); ?> > <a href="#" data-post_id="<?php echo esc_attr($acc_id); ?> " class="hover-effect popup-gallery"><?php echo get_the_post_thumbnail($acc_id, 'biggallery-thumb'); ?> </a> <?php if ($show_badge && !empty($discount_rate)) { ?> <span class="discount"><span class="discount-text"><?php echo esc_html($discount_rate . '%' . ' ' . __('Discount', 'trav')); ?> </span></span> <?php } ?> </figure> <div class="details"> <?php if ($list_style == "style1") { if (!empty($avg_price) && is_numeric($avg_price)) { ?> <span class="price"><small><?php _e('avg/night', 'trav'); ?> </small><?php echo esc_html(trav_get_price_field($avg_price)); ?> </span> <?php } ?> <h4 class="box-title"> <a href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php echo esc_html(get_the_title($acc_id)); ?> </a> <small><?php echo esc_html(trav_acc_get_city($acc_id) . ' ' . trav_acc_get_country($acc_id)); ?> </small> </h4> <div class="feedback"> <div data-placement="bottom" data-toggle="tooltip" class="five-stars-container" title="<?php echo esc_attr($review . ' ' . __('stars', 'trav')); ?> "><span style="width: <?php echo esc_attr($review / 5 * 100); ?> %;" class="five-stars"></span></div> <span class="review"><?php echo esc_html(trav_get_review_count($acc_id) . ' ' . __('reviews', 'trav')); ?> </span> </div> <p class="description"><?php echo wp_kses_post($brief); ?> </p> <div class="action clearfix"> <?php if (!empty($loc)) { ?> <a class="button btn-small" href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php _e('SELECT', 'trav'); ?> </a> <a class="button btn-small yellow popup-map" href="#" data-box="<?php echo esc_attr($loc); ?> "><?php _e('VIEW ON MAP', 'trav'); ?> </a> <?php } else { ?> <a class="button btn-small full-width" href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php _e('SELECT', 'trav'); ?> </a> <?php } ?> </div> <?php } elseif ($list_style == "style2") { ?> <a title="View all" href="<?php echo esc_url(get_permalink($acc_id)); ?> " class="pull-right button uppercase"><?php _e('select', 'trav'); ?> </a> <h4 class="box-title"><a href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php echo esc_html(get_the_title($acc_id)); ?> </a></h4> <?php if (!empty($avg_price) && is_numeric($avg_price)) { ?> <label class="price-wrapper"> <span class="price-per-unit"><?php echo esc_html(trav_get_price_field($avg_price)); ?> </span><?php _e('avg/night', 'trav'); ?> </label> <?php } } ?> </div> </article> <?php } elseif ($list_style == "style3") { ?> <article class="box"> <figure class="col-sm-5 col-md-4"> <a href="#" data-post_id="<?php echo esc_attr($acc_id); ?> " class="hover-effect popup-gallery"><?php echo get_the_post_thumbnail($acc_id, 'biggallery-thumb'); ?> </a> <?php if ($show_badge && !empty($discount_rate)) { ?> <span class="discount"><span class="discount-text"><?php echo esc_html($discount_rate . '%' . ' ' . __('Discount', 'trav')); ?> </span></span> <?php } ?> </figure> <div class="details col-xs-12 col-sm-7 col-md-8"> <div> <div> <h4 class="box-title"><a href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php echo esc_html(get_the_title($acc_id)); ?> </a><small><i class="soap-icon-departure yellow-color"></i> <?php echo esc_html(trav_acc_get_city($acc_id) . ' ' . trav_acc_get_country($acc_id)); ?> </small></h4> </div> <div> <div class="five-stars-container"> <span class="five-stars" style="width: <?php echo esc_attr($review / 5 * 100); ?> %;"></span> </div> <span class="review"><?php echo esc_html(trav_get_review_count($acc_id) . ' ' . __('reviews', 'trav')); ?> </span> </div> </div> <div> <p><?php echo wp_kses_post($brief); ?> </p> <div> <span class="price"><small><?php _e('avg/night', 'trav'); ?> </small><?php echo esc_html(trav_get_price_field($avg_price)); ?> </span> <a class="button btn-small full-width text-center" title="<?php _e('select', 'trav'); ?> " href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php _e('SELECT', 'trav'); ?> </a> </div> </div> </div> </article> <?php } elseif ($list_style == "style4") { ?> <div class="row"> <div class="col-xs-2"> <a href="<?php echo esc_url(get_permalink($acc_id)); ?> " class="badge-container"> <?php if ($show_badge && !empty($discount_rate)) { ?> <span class="badge-content"><?php echo __('save', 'trav') . '<br />' . esc_html($discount_rate) . '%'; ?> </span> <?php } ?> <?php echo get_the_post_thumbnail($acc_id, 'widget-thumb'); ?> </a> </div> <div class="col-xs-8"> <h5 class="box-title"><a href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php echo esc_html(get_the_title($acc_id)); ?> </a><small><?php echo esc_html(trav_acc_get_city($acc_id) . ' ' . trav_acc_get_country($acc_id)); ?> </small></h5> <p class="no-margin"><?php echo wp_kses_post($brief); ?> </p> </div> <div class="col-xs-2"> <span class="price"><small><?php _e('avg/night', 'trav'); ?> </small><?php echo esc_html(trav_get_price_field($avg_price)); ?> </span> <br /><br /> <a class="button green-bg pull-right" href="<?php echo esc_url(get_permalink($acc_id)); ?> "><?php _e('SELECT', 'trav'); ?> </a> </div> </div> <?php } echo wp_kses_post($after_article); }
" class="hover-effect middle-block"> <?php echo get_the_post_thumbnail($booking_data['accommodation_id'], 'thumbnail', array('class' => 'middle-item')); ?> </a> <div class="travel-title"> <h5 class="box-title"><a href="<?php echo esc_url($acc_url); ?> "><?php echo esc_html(get_the_title($booking_data['accommodation_id'])); ?> </a> <small> <?php echo esc_html(trav_acc_get_city($booking_data['accommodation_id'])); ?> <br /> <?php echo esc_html(trav_acc_get_country($booking_data['accommodation_id'])); ?> </small> </h5> <a href="<?php echo esc_url($edit_url); ?> " class="button"><?php _e('EDIT', 'trav'); ?> </a> </div>
?> </figure> <div class="details col-sm-7 col-md-8"> <div> <div> <h4 class="box-title"><a href="<?php echo esc_url($url); ?> "><?php echo esc_html(get_the_title($acc_id)); ?> </a><?php echo trav_acc_get_star_rating($acc_id); ?> <small><i class="soap-icon-departure yellow-color"></i> <?php echo esc_html(trav_acc_get_city($acc_id) . ' ' . trav_acc_get_country($acc_id)); ?> </small></h4> <div class="amenities"> <?php $facilities = wp_get_post_terms($acc_id, 'amenity'); $amenity_icons = get_option("amenity_icon"); $i = 0; $max_amenities = 5; foreach ($facilities as $facility) { if (is_array($amenity_icons) && isset($amenity_icons[$facility->term_id])) { if (isset($amenity_icons[$facility->term_id]['uci'])) { echo '<img class="custom_amenity" title="' . esc_attr($facility->name) . '" src="' . esc_url($amenity_icons[$facility->term_id]['url']) . '" height="28" alt="amenity-image">'; } else { if (isset($amenity_icons[$facility->term_id]['icon'])) { $_class = " circle";