Customize

Default booking form

The booking form is customizable. The form is free to define HTML input elements that can be referenced and/or in email notification templates later on display.

A single <input> element is absolutely necessary for the system to work properly:
<input type="email" name="email" required />

In addition, two blocks must be placed in the form where the system loads the items needed to select the day and time and check the robots:
<div class="appointment-month"></div> and
<div class="appointment-times"></div>
If these items are not in the template, the plugin will not work properly.

Customized form

Not only the form but also the appearance of the date picker can be made unique. An example of this can be found in the customize-sample folder in the installation package. Copy the contents of the to-functions-php.txt there into the (child) theme’s functions.php file, then the book-an-appointment folder into the (child) theme . If you do so, the form will appear as follows. Notice that a new field has also been added! Use as a template!

To set the first month of the date that appears, use the „start_month” parameter: [book-an-appointment target="<my_place>" start_month="6"]
If the month has passed, the current will appear, otherwise the set.

Overwrite the template

To display the booking form, the booking-form-single.html file in the „book-an-appointment” folder used by the page is first searched for in the (child) theme used by the page. If it is found, it will use this, if not, it will look for the same file in the „templates” folder in the plugin folder.

Warning! A possible update will overwrite the (possibly modified) template in the plugin folder. It’s a good idea to copy the template from the plugin’s folder to the „book-an-appointment” folder in the (child) theme, and then edit it as desired.

This template is a simple HTML file. It contains some links (eg. [NAME], which you can change from the language file by simply replacing them).

It is freely editable, then the <input> fields placed in it are accessible via their name IDs. For example, the value of the <input name="phone" /> field can later be accessed with the phone ID in the templates.

Transfer shortcode data to the template

You also have the option to pass data to the template via shortcode, which you can then use as your own field. The plugin passes all variables specified in the shortcode to the template for use. E.g.:

[book-an-appointment target="<my_place>" memo="This is sample value"]

The value of the memo field in the template e.g. Here’s how to refer:

<input type="hidden" name="<my_name>" value="<!-- memo -->" />

The plugin will replace the memo value in the value field. The result in the source will be:

<input type="hidden" name="<my_name>" value="This is sample value" />

Some values are automatically passed to the template and you can use them there:

<!-- blog_name --> Blog name
<!-- home_url --> Blog home url
<!-- current_url --> Current page URL
<!-- current_title --> Current page title
<!-- date --> Current date
<!-- time --> Current time
<!-- datetime --> Current date and time

Overwrite display

Display form informationThe plugin displays the information provided on the form to the administrator. To do this, use the book_an_appointment_961_booking_content filter, which may need to be overwritten.

To do this, you need to edit the functions.php file in the (child) theme folder and place the following php code in it:

// First, delete the default filter - if necessary
remove_filter('book_an_appointment_961_booking_content', 'book_an_appointment_961_booking_render_content_html', 11);

// Define the new procedure
function my_booking_render_content_html($data) {
	$data = unserialize($data);
	// Modify this block to suit your needs
	$html = '<strong>'.$data['name'].'</strong>' .
			'<div class="small">'.$data['phone'].'</div>' .
			'<div class="small"><a href="mailto:'.$data['email'].'">'.$data['email'].'</a></div>';    
	// End of block to be modified
	return $html;
}
// Use the new filter
add_filter('book_an_appointment_961_booking_content', 'my_booking_render_content_html', 12, 1);