PHP 8.2.31
Preview: functions.php Size: 23.30 KB
/proc/self/root/home/nshryvcy/blissfulnepal.com/wp-content/themes/traveltour-child/functions.php

<?php
session_start();
//
/*add my custom jquery script*/
add_action( 'wp_enqueue_scripts', 'menu_scripts' );
function menu_scripts() {
  wp_enqueue_style('my-style',
    get_stylesheet_directory_uri() . '/style.css'
);

wp_enqueue_script('moreless-script',
    get_stylesheet_directory_uri() . '/moreless.js'
);
wp_enqueue_script('my-script',
    get_stylesheet_directory_uri() . '/my-script.js'
);
        }

	// start your child theme code here
	
	// custom function to disable the trim excerpt
	// add_filter('wp_trim_excerpt', 'custom_disable_trim_excerpt', 11, 2);
	// function custom_disable_trim_excerpt( $excerpt, $original ){
	// 	if( !empty($original) ){
	// 		return $original;
	// 	}
	// 	return $excerpt;
	// }	
//require get_template_directory() . '/functions-hbl.php';


add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles');
function enqueue_child_theme_styles() {
    wp_enqueue_script( 'child-js', get_stylesheet_directory_uri() . '/child-script.js');
}

//
add_action( 'wp_ajax_destination_ajax', 'destination_ajax' );
add_action( 'wp_ajax_nopriv_fdestination_ajax', 'destination_ajax' );

function destination_ajax(){
	$term_id=$_POST['term_id'];
  $html='';
  $html.='<option value="">Select</option>';
    $args = array(
          'post_type'   => 'tour',
          'post_status' => 'publish',
          'posts_per_page'=>-1,
          'tax_query'   => array(
            array(
              'taxonomy' => 'tour-destination',
              'field'    => 'term_id',
              'terms'    => $term_id,
            )
          )
         );
        $loop = new WP_Query( $args );
        while( $loop->have_posts() ) : $loop->the_post(); 
          $title=get_the_title();
       $html.='<option value="'.$title.'" >'.$title.'</option>';
          endwhile;wp_reset_query();    
              
echo json_encode($html);
wp_die();
}


//departure form
add_action( 'wp_ajax_fix_dparture_form', 'fix_dparture_form' );
add_action( 'wp_ajax_nopriv_fix_dparture_form', 'fix_dparture_form' );
function fix_dparture_form(){
  $_SESSION['dep_price']=$_POST['dep_price'];
  $_SESSION['qty']=$_POST['qty'];
  $_SESSION['total_price']=$_POST['dep_price']*$_POST['qty'];
  $_SESSION['row_index']=$_POST['row_index'];
  $_SESSION['space']=$_POST['space'];
  $_SESSION['post_id']=$_POST['post_id'];
  echo json_encode(1);
  wp_die();
}


//departure form
add_action( 'wp_ajax_total_price_ajax', 'total_price_ajax' );
add_action( 'wp_ajax_nopriv_total_price_ajax', 'total_price_ajax' );
function total_price_ajax(){
  $_SESSION['total_price']=$_POST['price'];
  //echo json_encode(1);
  wp_die();
}
//
//departure form
add_action( 'wp_ajax_add_space_left', 'add_space_left' );
add_action( 'wp_ajax_nopriv_add_space_left', 'add_space_left' );
function add_space_left(){
    if($_SESSION['row_index']){
  	$post_id=$_SESSION['post_id'];
      $post_title=ucwords(get_the_title($post_id));

	$space_left = $_SESSION['space']-$_SESSION['qty'];

     $my_post = array(
      'post_title'    => $post_title,
      // 'post_content'  =>$post_content,
      'post_status' =>'publish',
      'post_type' => 'tour',
    );
     
          $my_post['ID'] = $post_id;
      
    if($post_id=wp_update_post( $my_post )){


        $row = array(
          'group_size' =>$space_left,
        );
      
          update_row('fixed_departure_dates_repeater',$_SESSION['row_index'], $row, $post_id);
}
}
  echo json_encode(1);
  wp_die();
}

//
function wpdocs_create_book_tax() {
  register_taxonomy( 
   'fix-departure',
   'tour',
    array(
    'label'        => __( 'Fix Departure', 'textdomain' ),
    'rewrite'      => array( 'slug' => 'fix-departure' ),
    'hierarchical' => true,
  ) );
}
add_action( 'init', 'wpdocs_create_book_tax', 0 );

//add reveiw
add_action( 'wp_ajax_review_form', 'review_form' );
add_action( 'wp_ajax_nopriv_review_form', 'review_form' );
function review_form(){
  global $wpdb;
    $table = $wpdb->prefix.'tourmaster_review';
    $current_user=wp_get_current_user();
     $args=array(
            //'user_id'      =>  $current_user->ID,
  'review_tour_id' => $_POST['tour_id'],
  'reviewer_name'    =>  $_POST['reviewer_name'],
  'reviewer_email'    =>  $_POST['reviewer_email'],
  'review_type'    =>  $_POST['review_type'],
  'review_description'=>$_POST['message'],
  'review_score'=>$_POST['rate'],
  'review_date'=>date('Y-m-d'),
        );
      if($wpdb->insert( $table, $args)){
        echo "Successful";
       }
  wp_die(); 
}//


// trip plan 
add_action( 'wp_ajax_plan_trip', 'plan_trip');
add_action( 'wp_ajax_nopriv_plan_trip', 'plan_trip');
function plan_trip() {
  $trip_name=$_POST['trip_name'];
  $destination=get_term($_POST['destination'])->name;
  $group_type=$_POST['sn-group-type'];
  $arr_date=$_POST['arr_date'];
  $dep_date=$_POST['dep_date'];
  $full_name=$_POST['full_name'];
  $email_id=$_POST['email_id'];
  $phone_no=$_POST['phone_no'];
  $emer_contact_no=$_POST['emer_contact_no'];
  $age_group=$_POST['age_group'];
  $tour_type=$_POST['tour-type'];
  $accommodations=$_POST['accommodations'];
  $estimated_budget=$_POST['estimated-budget'];
  $budget_flexible=$_POST['budget-flexible'];
  $message=$_POST['message'];
  $admin_email = 'info@blissfulnepal.com';
  //add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
  $subject = 'Inquiry Received from Trip Plan';
  $body=get_plan_trip($trip_name,$destination,$group_type,$arr_date,$dep_date,$full_name,$email_id,$phone_no,$emer_contact_no,$age_group,$tour_type,$accommodations,$estimated_budget,$budget_flexible,$message);
  $headers = 'From: blissfulnepal <info@blissfulnepal.com>' . "\r\n";
  $headers = array('Content-Type: text/html; charset=UTF-8');
  wp_mail($admin_email, $subject, $body, $headers);
   
  wp_die();
}

function get_plan_trip($trip_name,$destination,$group_type,$arr_date,$dep_date,$full_name,$email_id,$phone_no,$emer_contact_no,$age_group,$tour_type,$accommodations,$estimated_budget,$budget_flexible,$message){
   $html = '
   <table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;">
   <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Destination:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$destination.'</td>
  </tr>
   <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Trip Name:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$trip_name.'</td>
  </tr>
    <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Group Type:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$group_type.'</td>
  </tr>

   <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Arrival Date:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$arr_date.'</td>
  </tr> 
   <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Departure Date:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$dep_date.'</td>
  </tr>

  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Full Name:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$full_name.'</td>
  </tr>

  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Email:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$email_id.'</td>
  </tr>
  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Phone Number:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$phone_no.'</td>
  </tr>

  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Emergency Contact No:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$emer_contact_no.'</td>
  </tr>
  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Age Group:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$age_group.'</td>
  </tr>

  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Tour Type:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$tour_type.'</td>
  </tr>


  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Accomodation:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$accommodations.'</td>
  </tr>


  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Estimated Budget:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$estimated_budget.'</td>
  </tr>

  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Budget Flexible:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$budget_flexible.'</td>
  </tr>
 
  <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">Message:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$message.'</td>
  </tr>
   <tr>
    <td width="19%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">IP Address:</td>
    <td width="81%" style="border-bottom:1px solid #F2F2F2; padding:8px 10px">'.$_SERVER['REMOTE_ADDR'].' '.'<a href="http://whatismyipaddress.com/ip/'.$_SERVER['REMOTE_ADDR'].'">Check IP Address</a>'.'</td>
  </tr>
</table>';
    return $html;
    }

// inquiry
add_action( 'wp_ajax_inquiry_form', 'inquiry_form');
add_action( 'wp_ajax_nopriv_inquiry_form', 'inquiry_form');
function inquiry_form() {
  $trip_name=$_POST['trip_name'];
  $duration=$_POST['duration'];
  $full_name=$_POST['full_name'];
  $email_id=$_POST['email_id'];
  $contact_no=$_POST['contact_no'];
  $message=$_POST['message'];
  $admin_email = 'info@blissfulnepal.com';
  //add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
  $subject = 'Trip Inquiry';
  $body=get_trip_inquiry($trip_name,$duration,$full_name,$email_id,$contact_no,$message);
  $headers = 'From: blissfulnepal <info@blissfulnepal.com>' . "\r\n";
  $headers = array('Content-Type: text/html; charset=UTF-8');
  wp_mail($admin_email, $subject, $body, $headers);
   
  wp_die();
}

function get_trip_inquiry($trip_name, $duration, $full_name, $email_id, $contact_no, $message) {
    $html = '
    Trip Name: ' . $trip_name . '
    Duration: ' . $duration . '
    Full Name: ' . $full_name . '
    Email: ' . $email_id . '
    Contact Number: ' . $contact_no . '
    Message: ' . $message . '
    IP Address: ' . $_SERVER['REMOTE_ADDR'] . ' <a href="http://whatismyipaddress.com/ip/' . $_SERVER['REMOTE_ADDR'] . '">Check IP Address</a>';

    return $html;
}


function date_compare($a, $b)
{
    $t1 = strtotime($a['dates']);
    $t2 = strtotime($b['dates']);
    return $t1 - $t2;
}  

//


//
add_action( 'wp_ajax_autocomplete_departure', 'autocomplete_departure' );
add_action( 'wp_ajax_nopriv_autocomplete_departure', 'autocomplete_departure' );

function autocomplete_departure(){
  
global $wpdb; 
  $table=$wpdb->prefix.'space_left'; $list=$wpdb->get_row("select * from $table where dep_date='$startdate1' AND post_id='$postid'"); 
  $booked=$list->booked ? $list->booked : '0';

  $filter_month=$_POST['month']; 
  $year=$_POST['year']; 
  $post_id=$_POST['post_id'];

  $html='';
  $html.='<table class="dep-table" style="width:100%">
  <tr> <th style="width:44%;">Trip Dates</th> <th style="width:25%;">Price</th> <th style="width:35%;">Space Left</th> <th>Action</th> </tr>';

   $html1='';
   $trip_duration = get_post_meta($post_id, 'tourmaster-duration', true);
    $post_meta = tourmaster_get_post_meta($post_id, 'tourmaster-tour-option'); 

    $regular_price=$post_meta['tour-price-text'];
    $selling_price=$post_meta['tour-price-discount-text'];
    $price=$selling_price ? $selling_price : $regular_price;
    $discount_price=$regular_price-$selling_price;
    //$month=date('m');
     $number_of_days = cal_days_in_month(CAL_GREGORIAN,$filter_month, $year);
    for($x = 1; $x <= $number_of_days; $x++) {
     $day=date("l", strtotime($x . "-" . $filter_month . "-" . $year)); 
      if($day=='Monday' || $day=='Friday'){ 
    $start_date=date("F", strtotime($x . "-" . $filter_month . "-" . $year)) . " " . $x . "," . $year; 
    $start_month=date("m", strtotime($start_date));
      $startdate1=date("d-m-Y", strtotime($start_date)); 
      $start_year=date("m", strtotime($start_date));
      $total_pax=15;
 
$body.='<tr><td style="text-align: left;padding-left:18px;"><img src="https://www.himalayanwonders.com/assets/rblue/images/icons/trip-calendar.png" width="16" border="0" alt="calendar"> &nbsp; '.$start_date.' - '.date('F d, Y', strtotime($start_date. ' + '.$trip_duration.''.'- 1 day')).'</td><td><img src="https://www.himalayanwonders.com/assets/rblue/images/icons/tag.png" alt="tag"> &nbsp;<span class="reg_price">$'.$regular_price.'</span> $'.$selling_price.'<span class="save">Save $'.$discount_price.'</span></td><td><img src="https://www.himalayanwonders.com/assets/rblue/images/icons/member.png" alt="member">'.$booked.' Booked - <img src="https://www.himalayanwonders.com/assets/rblue/images/icons/member.png" alt="member">'.$total_pax-$booked.' Left</td><td> <form class="dep-form-submit-lg" action='.home_url('/fixed-departure-booking').' method="POST" ><input type="hidden" name="tour_id" value='.$post_id.'> <input type="hidden" name="start_date" class="tourmaster-datepicker-alt" value="'.$start_date.'"> <input type="hidden" name="end_date" class="tourmaster-datepicker-alt" value="'.date("F d, Y", strtotime($start_date. " + ".$trip_duration.""."- 1 day")).'"><input type="hidden" name="price" value="'.$price.'"> <input type="hidden" name="no_of_booking" value='.$booked.'> <input type="hidden" name="table_row" value="'.$list->id.'"> <input class="tourmaster-button" type="submit" value="Book Now" style="background:#559ef8;padding: 10px;"></form> </td> </tr>';
  }}
  $html1=$body;

  $html2='';
  $html2.='</table>';    
              
echo wp_unslash($html.''.$html1.''.$html2);
wp_die();
}

//
// tour fix departure mobile
add_action( 'wp_ajax_autocomplete_departure_sm', 'autocomplete_departure_sm' );
add_action( 'wp_ajax_nopriv_autocomplete_departure_sm', 'autocomplete_departure_sm' );

function autocomplete_departure_sm(){
  global $wpdb; 
  $table=$wpdb->prefix.'space_left'; $list=$wpdb->get_row("select * from $table where dep_date='$startdate1' AND post_id='$postid'"); 
  $booked=$list->booked ? $list->booked : '0';

  $filter_month=$_POST['month']; 
  $year=$_POST['year']; 
  $post_id=$_POST['post_id'];

   $html1='';
    $trip_duration = get_post_meta($post_id, 'tourmaster-duration', true);
    $post_meta = tourmaster_get_post_meta($post_id, 'tourmaster-tour-option'); 

    $regular_price=$post_meta['tour-price-text'];
    $selling_price=$post_meta['tour-price-discount-text'];
    $price=$selling_price ? $selling_price : $regular_price;
    $discount_price=$regular_price-$selling_price;
      //$year=date('Y'); //$month=date('m'); 
      $number_of_days = cal_days_in_month(CAL_GREGORIAN,$filter_month, $year);
      for ($x = 1; $x <= $number_of_days; $x++) { $day=date("l", strtotime($x . "-" . $filter_month . "-" . $year)); 
      if($day=='Monday' || $day=='Friday'){ 
    $start_date=date("F", strtotime($x . "-" . $filter_month . "-" . $year)) . " " . $x . "," . $year;
      $start_month=date("m", strtotime($start_date));
      $startdate1=date("d-m-Y", strtotime($start_date)); 
      $start_year=date("m", strtotime($start_date));
      $total_pax=15;
 
$body.='<div class="table-append-sm"><div class="border-box"> <ul class="mob-departures"> <li><strong>Trip Dates</strong> &nbsp; &nbsp;&nbsp; <img src="https://www.himalayanwonders.com/assets/rblue/images/icons/trip-calendar.png" width="16" border="0" alt="calendar"> &nbsp; '.$start_date.' - '.date('F d, Y', strtotime($start_date. ' + '.$trip_duration.''.'- 1 day')).' </li><hr> <li><strong>Price</strong>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <img src="https://www.himalayanwonders.com/assets/rblue/images/icons/tag.png" alt="tag"><span class="reg_price">$'.$regular_price.'</span> $'.$selling_price.' <span class="save">Save $'.$discount_price.'</span> </li> <hr><li><strong>Space Left</strong>&nbsp; &nbsp;&nbsp;<img src="https://www.himalayanwonders.com/assets/rblue/images/icons/member.png" alt="member">'.$booked.' Booked - <img src="https://www.himalayanwonders.com/assets/rblue/images/icons/member.png" alt="member">'.$total_pax-$booked.' Left <form class="dep-form-submit-sm" method="POST" action='.home_url('/fix-departure').'><input type="hidden" name="tour_id" value='.$post_id.'><input type="hidden" name="start_date" class="tourmaster-datepicker-alt" value='.$start_date.'><input type="hidden" name="end_date" class="tourmaster-datepicker-alt" value='.date('F d, Y', strtotime($start_date. ' + '.$trip_duration.''.'- 1 day')).'><input type="hidden" name="price" value='.$price.'><input type="hidden" name="no_of_booking" value='.$booked.'><input type="hidden" name="table_row" value='.$list->id.'> <input class="tourmaster-button"  type="submit" value="Book Now" style="background:#559ef8;padding: 10px;"></form></li> </ul> </div></div>';
  }}
  $html1=$body;
  
              
echo wp_unslash($html1);
wp_die();
}

//
add_action( 'wp_ajax_autocomplete_add_services', 'autocomplete_add_services' );
add_action( 'wp_ajax_nopriv_autocomplete_add_services', 'autocomplete_add_services' );
function autocomplete_add_services(){
  $service_name=$_POST['service_name'];
  $service_qty=$_POST['service_qty'];
  $post_id=$_POST['post_id'];
  $data_id=$_POST['data_id'];

  $serprice=get_post_meta($post_id, 'tourmaster-service-option', true);
  $eser_price=$serprice['price'];
 $html='';
  if(class_exists('"sec_'.$data_id.'"',true)){
 $html.='test';
 } else {
   
        $html.='<span class="sec_'.$data_id.' tt"><li>'.$service_name.'<span class="ser-price ser-price_'.$data_id.'">'.$service_qty*$eser_price.'</span><span>USD $</span></li><p>'.$service_qty.'x'.$eser_price.'</p><span>';
 }

 echo wp_unslash($html);
wp_die();
}


// Book without payment

add_action('wp_ajax_book_form', 'book_form');
add_action('wp_ajax_nopriv_book_form', 'book_form');

function book_form() {
    // Check if data was sent through POST
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        // Verify nonce
        if ( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'book_form_nonce' ) ) {
            wp_send_json_error( 'Nonce verification failed' );
        }

        // Sanitize and retrieve form data
        $trip_name = sanitize_text_field($_POST['trip_name']);
        $travel_date = sanitize_text_field($_POST['travel_date']);
        $fullname = sanitize_text_field($_POST['fullname']);
        $email_address = sanitize_email($_POST['email_address']);
        $country = sanitize_text_field($_POST['country']);
        $city = sanitize_text_field($_POST['city']);
        $arrival_date = sanitize_text_field($_POST['arrival_date']);
        $departure_date = sanitize_text_field($_POST['departure_date']);
        $inform = sanitize_textarea_field($_POST['inform']);
        $no_persons = sanitize_text_field($_POST['no_persons']);
        $full_payment = sanitize_text_field($_POST['full_payment']);

        // Compose email content
        $to = 'info@blissfulnepal.com'; // Replace with your email address
        $subject = 'New Booking for ' . $trip_name;
        $message = "Trip Name: $trip_name\n";
        $message .= "Travel Date: $travel_date\n";
        $message .= "Full Name: $fullname\n";
        $message .= "Email Address: $email_address\n";
        $message .= "Country: $country\n";
        $message .= "City: $city\n";
        $message .= "Arrival Date: $arrival_date\n";
        $message .= "Departure Date: $departure_date\n";
        $message .= "Other Information: $inform\n";
        $message .= "Number of Participants: $no_persons\n";
        $message .= "Full Payment: $full_payment\n";

        // Additional headers
        $headers = array('Content-Type: text/html; charset=UTF-8');

        // Send email
        $sent = wp_mail($to, $subject, $message, $headers);

        if ( $sent ) {
            wp_send_json_success( 'Email sent successfully' );
        } else {
            wp_send_json_error( 'Failed to send email' );
        }
    }
}

// 
add_action( 'wp_ajax_autocomplete_departures', 'autocomplete_departures' );
add_action( 'wp_ajax_nopriv_autocomplete_departures', 'autocomplete_departures' );
function autocomplete_departures(){

//$post_id=$_POST['post_id'];
$num=$_POST['num'];
$inc=$num+15;
//echo $inc;

  $html='';
  $html.='<table style="width:100%"><tr> <th>Trip Name</th> <th>Trip Dates</th> <th>Price</th> <th>Action</th> </tr>';
$html1='';
  $args = array(
      'post_type'   => 'tour',
      'post_status' => 'publish',
      'posts_per_page'=>-1,
     'tax_query'   => array(
    array(
      'taxonomy' => 'popular-deals',
      'field'    => 'term_id',
      'terms'    =>296,
    )
  )
     );
    $loop = new WP_Query( $args ); 
      $count = $loop->found_posts;
      $i=0;
  while( $loop->have_posts() ) : $loop->the_post();
     $title=get_the_title();
     $post_id=get_the_ID();
     $link=get_the_permalink();
     $trip_duration = get_post_meta(get_the_ID(), 'tourmaster-duration', true);
$post_meta = tourmaster_get_post_meta(get_the_ID(), 'tourmaster-tour-option');
$regular_price=$post_meta['tour-price-text'];
$selling_price=$post_meta['tour-price-discount-text'];

$price=$selling_price ? $selling_price : $regular_price;

$dep_months=get_field('select_fix_departure_months');
foreach($dep_months as $dm){
     $year=date('Y');
 //$month=date('m');
 $number_of_days = cal_days_in_month(CAL_GREGORIAN,$dm, $year);
for ($x = 1; $x <= $number_of_days; $x++) {
   $day=date("l", strtotime($x . "-" . $dm . "-" . $year));
    if($day=='Sunday' || $day=='Tuesday' || $day=='Friday'){
      $start_date=date("F", strtotime($x . "-" . $dm . "-" . $year)) . " " . $x . "," . $year;
      $start_month=date("m", strtotime($start_date));
    $start_year=date("m", strtotime($start_date));
if($month<$start_month){
       if ($i ==$inc) {
    break;
  }

  $html1.='<tr> <td style="margin-left: 10px;"> <a href="'.$link.'" target="_blank">'.$title.' </a> </td> <td style="text-align: center;">'. $start_date.''.' -'.date('F d, Y', strtotime($start_date. ' + '.$trip_duration.''.'- 1 day')).' </td> <td> USD $'.$price.' </td> <td> <form class="dep-form-submit-lg" method="POST" action='.home_url('/fixed-departure-booking').'> <input type="hidden" name="tour_id" value='.$post_id.'> <input type="hidden" name="start_date" class="tourmaster-datepicker-alt" value="'.$start_date.'""> <input type="hidden" name="end_date" class="tourmaster-datepicker-alt" value="'.date('F d, Y', strtotime($start_date. ' + '.$trip_duration.''.'- 1 day')).'"> <input type="hidden" name="price" value='.$price.'> <input class="tourmaster-button" type="submit" value="Book Now" style="background:#559ef8;padding: 10px;""> </form> </td></tr>';
$i++;}}}} endwhile;wp_reset_query();

$html2='';
$html2.='</table>';

if($inc==$i){

$html3='';
$html3.='<div class="view-more-btn mt-4"> <button type="button" class="btn btn-md btn-secondary load more-departure" data-page="'.$inc.'"> Load More </button> </div>';

   } else {
    $html3.='<div class="view-more-btn mt-4"> <button type="button" class="btn btn-md btn-secondary load more-departure" data-page="15"> Load Less </button> </div>';
   }
  echo wp_unslash($html.''.$html1.''.$html2.''.$html3);
  wp_die();
}

Directory Contents

Dirs: 2 × Files: 21

Name Size Perms Modified Actions
images DIR
- drwxr-xr-x 2024-05-28 15:48:51
Edit Download
payment DIR
- drwxr-xr-x 2024-06-03 04:31:13
Edit Download
499 B lrw-r--r-- 2024-05-28 15:48:51
Edit Download
43.54 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download
1.84 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download
9.63 KB lrw-r--r-- 2024-06-11 07:55:31
Edit Download
5.68 KB lrw-r--r-- 2024-06-13 12:10:47
Edit Download
23.30 KB lrw-r--r-- 2025-01-16 09:29:12
Edit Download
0 B lrw-r--r-- 2024-06-04 09:12:46
Edit Download
518 B lrw-r--r-- 2024-05-28 16:36:36
Edit Download
5.31 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download
3.37 KB lrw-r--r-- 2024-05-28 15:48:53
Edit Download
6.87 KB lrw-r--r-- 2024-06-05 11:48:19
Edit Download
10.07 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download
10.23 KB lrw-r--r-- 2024-05-28 15:48:53
Edit Download
11.70 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download
5.25 KB lrw-r--r-- 2024-05-28 16:39:02
Edit Download
5.21 KB lrw-r--r-- 2024-05-28 15:57:30
Edit Download
4.78 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download
902 B lrw-r--r-- 2024-05-28 15:48:51
Edit Download
9.14 KB lrw-r--r-- 2024-06-02 04:39:31
Edit Download
940 B lrw-r--r-- 2024-05-28 15:48:53
Edit Download
4.90 KB lrw-r--r-- 2024-05-28 15:48:51
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).