How to Use Separate Event Booking Forms in Diarise by Woo Themes

By default, the Diarise theme by Woo Themes, allows you to specify a single event booking form throughout the site.  You do this via the Diarise | Theme Options | Booking Form settings within your WordPress dashboard.

For our Thinkspinner Innovation site, though, we needed each event to have it’s own booking form, since we’re using Guest List.  The same would be true if you were using EventBrite or some other external ticketing or registration tool.

Digging into the theme, it turns out to be not that hard to add this as an option.  My hope, of course, is that when I bring this solution to the attention of the Woo Theme team, they will update Diarise to include this option.

There are three files in the theme that need update to support the change. First, we need to make the option available in the Theme Options | Booking Form section.

Open the file includes/theme-options.php and change line 33 to this:

1
$options_bookings = array("disabled" => "Disabled","bookingform" => "Use Booking Form","bookingurl" => "Use External Booking URL","postbypost" => "Use URL Given in Post");

That gives us a fourth radio button to select that activates the option.  Next we need to be able to provide that URL in the post, which means updating the Woo options box in the post.  Still in includes/theme-options.php, add the following code, starting on line 558:

1
2
3
4
5
6
7
"event_booking_form" => array (
    "name"  => "event_booking_form",
    "std"  => "",
    "label" => "Event Booking Form",
    "type" => "text",
    "desc" => "Enter the external booking form for the event"
),

Save and close that file.  You can now go to an event post and within that box provide the URL for your external booking form specific to that event.

Next, there are two places where we need to update the display – on the home page in the featured events area and in the header on the event’s own post display.  In both places, there’s a button “Book Tickets” that should go to the newly specified URL.

For the home page, open includes/events-calendar.php.  You’ll be replacing lines 716-718 of that file:

1
2
3
<?php if ($woo_booking_form == 'disabled') { } else { ?>
    <a href="<?php if ($woo_booking_form == 'bookingurl') { echo $woo_booking_form_external_url; } else { echo get_bloginfo('url').'/'.$woo_booking_form_page.'/?event_id='.$post->ID; } ?>" class="button book-tickets"><?php _e('Book Tickets', 'woothemes'); ?></a>
<?php } ?>

Delete that code and replace it with this instead:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
    switch ($woo_booking_form) {
        case 'disabled':
            // Do nothing
            break;
           
        case 'bookingurl':
            echo '<a href="'.$woo_booking_form_external_url.'" class="button book-tickets">';
            _e('Book Tickets', 'woothemes');
            echo '</a>';
            break;
       
        case 'bookingform':
            echo '<a href="'.get_bloginfo('url').'/'.$woo_booking_form_page.'/?event_id='.$post->ID.'" class="button book-tickets">';
            _e('Book Tickets', 'woothemes');
            echo '</a>';
            break;
           
        case 'postbypost':
            $event_booking_form = get_post_meta($post->ID,'event_booking_form',true);
            echo '<a href="'.$event_booking_form.'" class="button book-tickets">';
            _e('Book Tickets', 'woothemes');
            echo '</a>';
            break;
    }
?>

Save and close that file. We also have to update the event page itself, so open single.php. Delete lines 91-93 of that file, which are the same three lines as appear in events-calendar.php as shown above, and replace them with the same block of code I just shared with you.

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

Comments are closed.