function get_booked_days() { $room_id = $_GET['room_id']; $bookings = get_bookings($_GET['room_id']); $n_booking = count($bookings); $i = 0; echo '['; foreach ($bookings as $daybooked) { $i++; ?> { "id": "<?php echo $daybooked->ID; ?> ", "title" : "<?php echo $daybooked->post_title; ?> <?php echo date("d/m/Y", get_post_meta($daybooked->ID, 'checkin', true)); ?> <?php echo date("d/m/Y", get_post_meta($daybooked->ID, 'checkout', true)); ?> ", "start" : "<?php echo date("Y-m-d", get_post_meta($daybooked->ID, 'checkin', true)); ?> ", "end" : "<?php echo date("Y-m-d", get_post_meta($daybooked->ID, 'checkout', true)); ?> ", "allDay" : true }<?php if ($i < $n_booking) { echo ','; } } echo ']'; exit; }
<?php /* Template Name: Room Calendar */ /** * The header for our user logged theme. * * Displays all of the <head> section and everything up till <div id="content"> * * @package bookingwp */ get_template_part('management-templates/header-user'); $occupancy = get_bookings($_GET['room_id']); //print_r($occupancy); ?> <div class="container manager"> <div class="row"> <div class="col-md-12"> <div class="page-header"> <h2><i class="fa fa-calendar"></i> Visual Calendar <small>Availability management</small></h2> </div> </div> </div> <div class="row"> <div class="col-md-3"> <div class="thumbnail"> <?php echo get_the_post_thumbnail($_GET['room_id'], 'homepage-thumb'); ?> <div class="caption">