Support » Plugin: WP Simple Booking Calendar » Displaying current dates "red" or "green" on homepage?

  • Hi, I was wondering if someone could point me in the right direction? I am learning php, and am a little stuck. What I want to do is display a message based on the availability and current date. For example if the current day is “red” in the calendar a message on the homepage says “we are available” with a link to the contact page, if the current date is “red” then the php looks for the next available date, and message states “we are unavailable until 02, 28, 2014.” With a link to the calendar page. Any ideas?
    I would also love to turn this into a shortcode.

Viewing 2 replies - 1 through 2 (of 2 total)
  • simplebookingcalendar


    Here’s a start:

    $calendarID = 1;
    $sql = $wpdb->prepare('SELECT * FROM ' . $wpdb->base_prefix . 'sbc_calendars WHERE calendarID=%d',$calendarID);
    $calendar = $wpdb->get_row( $sql ); $bookedDates = json_decode($calendar->calendarData, true);
    if(isset($bookedDates[date('Y')][date('m')][date('j')]) && $bookedDates[date('Y')][date('m')][date('j')] != 'default'){
        echo "Booked";
    } else {
        echo "Not Booked";

    for more info you can: print_r($calendar

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying current dates "red" or "green" on homepage?’ is closed to new replies.