Integrating Booking Calendar Shortcodes in DIVI Builder

Integrating Booking Calendar Shortcodes in DIVI Builder

To add Booking Calendar shortcodes to your pages in DIVI Builder using the "Code" module, please follow these steps:

  1. Edit the page where you want to add the Booking Calendar shortcode in the DIVI Builder.
  2. Add a new section or row where you want the Booking Calendar to appear.
  3. Within the section or row, add a new module and select the "Code" module.
  4. In the Code module settings, paste the Booking Calendar shortcode.
  5. Customize the settings of the Code module as needed, such as adjusting the alignment or size.
  6. Save or update the page.

By following these steps, you'll be able to seamlessly integrate Booking Calendar shortcodes into your DIVI Builder pages using the "Code" module.

Showing Only Booking Calendar Admin Panel for Users

To enable the display of the booking admin panel exclusively for specific users, you'll need to install an additional plugin that restricts access to other pages in the WordPress admin panel. You can use the "User Role Editor" plugin or any other plugin of your choice that offers similar functionality.

Follow these steps to show only the booking admin panel for "Subscriber" users in your WordPress admin panel:

  • Navigate to WP Booking Calendar > Settings General page in the "Plugin Menu / Permissions" section. Set the value "Subscriber" for each plugin menu option in the "User permissions for plugin menu pages" section.
  • Install the "User Role Editor" plugin by going to WordPress > Plugins > "Add New Plugin" menu. Alternatively, install another plugin that can restrict access to the WordPress admin plugin pages.
  • Open the Users > User Role Editor page and ensure that only one "Read" capability is defined for "Subscriber" users. Save changes.
  • Log in with another WordPress user who has only the "Subscriber" user role and test it.

Important Note: If you have any questions about configuring the "User Role Editor" plugin or another plugin with similar functionality, please contact the support of that specific plugin for assistance. We can only provide help with configuring the Booking Calendar plugin. Thank you for your understanding.

Is it possible to redirect to a new page and display booking details after submitting a booking?

You can enable the "Redirect to thank you page" option on the Booking > Settings General page in the "Booking Confirmation" section. This allows visitors to be redirected to a specified page after creating a new booking. To showcase the confirmation and "booking details" on this page, simply insert the following shortcode:

[booking_confirm]

For guidance on inserting Booking Calendar shortcodes into a page, refer to the instructions on this page, particularly in the 4. Manual Shortcode Configuration section.

Tracking form submission

Deprecated for Update 9.8 or newer

1) Simple way of tracking after redirection to the "Thank you" page.
In case, if you do not have showing "Payment form(s)" after submission of the bookings (in paid versions of Booking Calendar), and you have defined the "Redirection to the "Thank you" page (instead o showing "Thank you" message) at the Booking > Settings General page in Form section, so then simplest way to add your "tracking code" (like Google Adwords code) inside of your "Thank you" page. Please open your "thank you" page for editing, switch to the "Text view mode" of your content editor (html view mode) and insert your Tracking code, which was provided by Google Adwords or some other tracking service.

2) Other more flexible way of tracking booking form submission is adding code in your functions.php file of your theme.
Firs of all please update your version of Booking Calendar to the update 8.6 or newer. You can request the new update of paid versions of Booking Calendar on this page.

After this add inside of the functions.php file of your theme code similar to this,
(you can check how to edit files in WordPress menu in this article):

function my_booking_tracking( $params ){
   ?><!-- Google Code for Booking Conversion Page -->
   <script type="text/javascript">
    /* Insert bellow your Google Tracking Code  */
   </script><?php
}
add_action( 'wpbc_track_new_booking', 'my_booking_tracking' );

Kind Regards.

Configuration ability to View and Manage bookings by customers, who made the booking

Configuration of ability to view and manage all previous bookings of user, at front-end side of your website. Visitors of your website, can view previous (own) bookings, by clicking on secret link in email, which is sending after booking created.

Important! Please note, if you open this page directly, you will see this warning "You do not set any parameters for booking editing". It's because system allow to open this page only from link(s) in email templates, which your website visitor had to received, after he/she made the booking (inside of that link will be specific parameter (secret HASH) for the identification of the booking). Check more about such type of configuration here.

Is there any API or hooks for using with Booking Calendar ?

1) Currently there is no full API for using Booking Calendar plugin with other plugins or services.
Some hooks exist, but they does not documented well, yet. We are in process of improving this with future updates of plugin.

2) But still plugin have some useful functions and hooks for such purpose.
Please check this file ../{Booking Calendar Folder}/core/wpbc-dev-api.php
Here you can find some useful functions and hooks.

How to edit file from WordPress menu

How to Edit CSS in the Theme Editor

The location of the CSS section for editing CSS files depends on your theme.
For standard Classic Themes, it is usually located in the "Appearance > Theme Editor" section.
Edit CSS in Classic WordPress themes

However, in the new WordPress Block themes, it can be found in "Appearance > Editor > Styles". Then, within the Style Widget (located on the right side of the editor), there is an "Additional CSS" section at the bottom for editing CSS. The exact path may vary depending on the theme. (It was explained using the default Twenty Twenty-Four theme as an example).
Edit CSS in Block WordPress themes

How to Edit Plugin files

WordPress update 4.9 or newer.
Since update 4.9 of WordPress, its was updated interface of editing plugin files via WordPress admin panel.
1) Now, you can open WordPress admin panel, then
2) Open WordPress > Plugins > Editor menu
3) In the top right side for option "Select plugin to edit" select "Booking Calendar" plugin (please note, if you have several versions of Booking Calendar (for example, Booking Calendar Free version as deactivated version and paid version, so you will see both options there, and you need to select correct, activated version of your version of Booking Calendar) and click "Select" button
4) Now at right side you can see files and folders of plugin, you can select specific file to edit and make your customization,
after this click on Save changes button.
5) Clear browser cache and test it.

WordPress update 4.8 or older.
1) Open the WordPress Plugins menu page.

2) Click on "Edit" link under the "Booking Calendar" plugin.

3) On the right side of that page, please find specific file, like this:

booking/css/client.css

Or some other that you require. Click on that link.

Please note, if you do not see some specific file in list at the right side, so probably this file in some sub-folder (WordPress Edit plugin menu page do not show links to all files at once).
You will be need to edit URL in your browser and specify directly, what file to edit.

One restriction. (Booking Calendar Free version have name of plugin folder "booking", paid versions of Booking Calendar can have different names. For example Booking Calendar Personal version can have name of folder like this: booking.personal.7.0 (etc). So you will be need to change in URL this folder appropriately.

For example, if you need to edit this file: ../{Booking Calendar Folder}/core/admin/page-email-trash.php
Then you need to edit URL to this:
https://your-server.com/wp-admin/plugin-editor.php?file=booking/core/admin/page-email-trash.php

Important part here this path: ?file=booking/core/admin/page-email-trash.php
And in case, if you use some paid version, you will be need to replace folder name from "booking" to "booking.personal.7.0" or some other.

4) Make edit of this file.

5) Then click on "Update file" button to save changes.

6) Clear browser cache and test it.

Configuring Different Types of Day Selection for Different Calendars

Follow this detailed guide to customize day selection for different calendars using JavaScript integration.

Insert Booking Shortcode:
You can use this JavaScript AFTER the booking shortcode, like this: [booking resource_id=1] in the WordPress post or page editor. While the examples provided here use this shortcode, keep in mind that in your own examples, you'll likely have different parameters for the booking shortcode, such as ID of booking resource. To learn more about how to insert and configure the booking shortcode into your posts or pages, please read our guide here.

JavaScript Insertion:
Please note: You can insert JavaScript only if you are logged in as an admin user. Subscriber users do not have the permission to insert JavaScript into posts or pages. Follow these steps to add custom JavaScript:

  • Classic Editor: Switch from "Visual" mode to "Text" mode by clicking the "Text" tab at the top right of the post content form.
  • Block Editor: Add a "Custom HTML" block, where you can configure the custom JavaScript code. Or switch from Visual Editor to Code Editor by pressing "Ctrl + Shift + Alt + M" or by using the options toolbar at the top right of the page.
  • Elementor: Add an HTML Widget and follow these steps:

    • Edit Page: Navigate to the page you want to edit in Elementor and click on "Edit with Elementor."
    • Add HTML Widget: Drag and drop the HTML widget from the Elementor widget panel onto the desired section of the page.
    • Edit HTML Widget: Click on the "Edit" button of the HTML widget.
    • Insert JavaScript: Insert your custom JavaScript script in the HTML code editor.
    • Wrap Script: Wrap your JavaScript script inside the <script> tags. For example, <script> your JS code here </script>.
    • Save and Preview: Save your changes and preview your website to ensure that the custom JavaScript script is executed properly.

Customization for Booking Calendar Version 9.8.9 or Newer Updates

Single Day Selection
Activate the Single Day Selection mode with the following code. This code is used to enable single-day selection in the current booking form if you have a different type of day selection set as the default at the General Booking Settings page.

[booking resource_id=1]
<script type="text/javascript">
   var wpbc_resource_id = 1;
   wpbc_cal_ready_days_select__single( wpbc_resource_id );
</script>

Please note that in this code, the line var wpbc_resource_id = 1; defines the ID of the booking resource (calendar). You can find the IDs of your booking resources on the Booking > Resources page. Be sure to use the same resource ID in the shortcode with the wpbc_resource_id parameter.


Multiple Days Selection
Enable Multiple Days Selection mode with the following code:

[booking resource_id=1]
<script type="text/javascript">
   var wpbc_resource_id = 1;
   wpbc_cal_ready_days_select__multiple( wpbc_resource_id );
</script>

Please note that in this code, the line var wpbc_resource_id = 1; defines the ID of the booking resource (calendar). You can find the IDs of your booking resources on the Booking > Resources page. Be sure to use the same resource ID in the shortcode with the resource_id parameter.


Range Days Selection with a Fixed Number of Days with 1 Mouse Click.
Activate the Range Days Selection with a fixed number of days using a single mouse click with the following code:

[booking resource_id=1]
<script type="text/javascript">
   var wpbc_resource_id = 1;
   wpbc_cal_ready_days_select__fixed( wpbc_resource_id, 7, [-1] );
</script>

In this code, we are using 3 parameters:

Parameter #1 - Resource ID:
The line var wpbc_resource_id = 1; define the ID of the booking resource (calendar). Locate the IDs of your booking resources on the Booking > Resources page, and ensure you use the same resource ID in the shortcode with the wpbc_resource_id parameter in JavaScript code.

Parameter #2 - Number of Dates to Select:
The second parameter, in our case, sets the number of dates for selection to 7 days.

Parameter #3 - Start Week Day(s) Selection:
The third parameter, represented as an array, allows you to specify the starting day(s) of the week. Assign values according to the following:

    0: Sunday
    1: Monday
    2: Tuesday
    3: Wednesday
    4: Thursday
    5: Friday
    6: Saturday

[-1] - defines the selection of any weekdays.

For example, if you want the start day of the range selection to be Saturday and you want to select 2 days, use this code:

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__fixed( wpbc_resource_id, 2, [6] );

If you want to set the start day of range selections as Monday and Friday and make a selection of 4 days, use this code:

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__fixed( wpbc_resource_id, 4, [1,5] );

The following codes are equivalent:

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__fixed( wpbc_resource_id, 7, [-1] );

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__fixed( wpbc_resource_id, 7, [0,1,2,3,4,5,6] );


Range Days Selection as a Dynamic Range of Days with 2 Mouse Clicks.
This code enables this type of day selection for the current booking form if you have a different type of day selection set as the default at the General Booking Settings page.
Activate the Range Days Selection with a dynamic range of days using 2 mouse clicks with the following code:

[booking resource_id=1]
<script type="text/javascript">
  var wpbc_resource_id = 1;
  wpbc_cal_ready_days_select__range( wpbc_resource_id, 7, 14, [], [-1] );
</script>

In this code, we are using 5 parameters:

Parameter #1 - Resource ID:
The line var wpbc_resource_id = 1; define the ID of the booking resource (calendar). Locate the IDs of your booking resources on the Booking > Resources page, and ensure you use the same resource ID in the shortcode with the wpbc_resource_id parameter in JavaScript code.

Parameter #2 - Minimum Number of Days to Select:
The second parameter defines the minimum number of days to select. In our example, it's 7 days.

Parameter #3 - Maximum Number of Days to Select:
The third parameter represents the maximum number of days to be selected with 2 mouse clicks. In our example, it's 14 days.

Parameter #4 - Specific Number of Days to Select:
The fourth parameter is an array that specifies the specific number of days that can be selected.
- To allow any number of days, use this parameter: []
- To allow only week-based selections, such as 7 days, 14 days, 21 days, and so on, use this parameter: [7,14,21].

Parameter #5 - Start Week Day(s) Selection:
The fifth parameter is an array where you can specify the start day of the range days selection.
Specify a specific day of the week or multiple days as the start day for the range selections, use the following values:

    0: Sunday
    1: Monday
    2: Tuesday
    3: Wednesday
    4: Thursday
    5: Friday
    6: Saturday

[-1] - defines the selection of any weekdays.

For example, to start the range selection on Saturday and make a selection from 3 to 10 days, use this code:

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__range( wpbc_resource_id, 3, 10, [], [6] );

To start the range selection on Monday and Friday and make a selection of only weeks, use this code:

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__range( wpbc_resource_id, 7, 28, [7,14,21,28], [1,5] );

The following codes are equivalent:

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__range( wpbc_resource_id, 7, 14, [], [-1] );

var wpbc_resource_id = 1;
wpbc_cal_ready_days_select__range( wpbc_resource_id, 7, 14, [], [0,1,2,3,4,5,6] );


If you're using version 9.7.7 or older, you can refer to the Legacy FAQ for Configuring Different Types of Day Selection at this link.
This resource should provide the guidance you need for configuring different types of day selection in your older version of the plugin.

How to insert booking shortcode into any other place of site (not inside of post or page) ?

1. Please read what type of shortcodes you are want to insert here
2. Open for edit your theme (PHP) file. For example: single.php.
3. Insert this code for showing booking form

<?php echo do_shortcode("[booking type=1 nummonths=1]"); ?>

where instead of this shortcode: [booking type=1 nummonths=1], can be any other shortcode from the point #1.
4. save the changes in the PHP file.