Appointments Booking - Shortcodes
TIP: What Are Shortcodes
Shortcodes add dynamic content to your site via a small piece of code.
The appointment booking supports two shortcodes.
Use: Shows the front-end view of the calendar defined in
There are two ways to customize this shortcode: filter parameters and label parameters
a) Making calendar more specific with Filter Parameters
- calendar - (obligatory) Defines which calendar will be shown. Identify it by the slug.
- min_date - (optional) The earliest possible date available for making bookings.
- max_date - (optional) The last possible date available for making bookings.
- view_duration - (optional) The default view of the calendar. Accepts
- default - fetches the value from the general settings
[cm_event_booking_calendar calendar="my-booking-calendar" view_duration=week min_date="01.01.1970" max_date="01.01.2050"]
In the front-end:
Note about the calendar slug
The “slug” is the URL-friendly version of the calendar's name. If you need to find out the slug of a specific calendar, you can find it on the "slug" field of the Edit Calendar's page:
The same page has another field which contains the full shortcode with the calendar parameter, for easier access.
b) Translating calendar with Label Parameters
All label parameters are optional. You should use them to customize specific calendars.
The plugin has label settings to configure the default labels of all calendars. Learn more: Appointments Booking - Settings - Labels (Changing The Front-End Text).
The specific labels you set in each shortcode will take priority over the general settings.
- today_label - Label for the button "Today"
- month_label - "Month"
- day_label - "Day"
- week_label - "Week"
- days_labels - Weekdays from Sunday to Monday. First item has to be Sunday
- mon_labels - Labels for each month, starting from January
- mon_short_labels - Labels for each month initial, starting from January
TIP: Translating a Calendar to Spanish
The following example translates all labels of the calendar to Spanish
[cm_event_booking_calendar calendar="my-booking-calendar" todaly_label="Hoy" month_label="Mes" day_label="Dia" week_label"=Semana" days_labels="domingo,martes,miércoles,jueves,viernes,sábado" mon_labels="enero, febrero, marzo, abril, mayo, junio, julio, agosto, septiembre, octubre, noviembre, diciembre" mon_short_labels="en, fe, ma, ab, ma, ju, ju, ag, se, oc, no, di"]
2) Discussion Form
- Use: Directs the customers to the discussion form page.
- Parameters: none.
How it works
The discussion form is used only when the calendar moderator is asking to discuss with the customer a specific booking request.
Unlike the first shortcode which is per a specific calendar, the discussion form shortcode serves all calendars defined in the plugin settings. Once added to a page, the admin needs to visit the plugin Options and set this page as the default discussion page.
The discuss button can be found when managing the bookings.
Once this request is sent, the customer receives a link which directs them to the page which includes this shortcode.
Once clicking on this link he sees the discussion form which let him respond and view all previous discussions related to this booking request.
3) Booking List
Use: This shortcode is used for displaying only upcoming booked events.
- calendar_slug - Obligatory parameter, the shortcode will not work without it. As a value must be set the calendar's slug.
- list_title - Used for displaying the title above the booking list. Default value is "Upcoming Events".
- events_count - Used for how many upcoming events should be displayed. Default value is 5.
- current_user_bookings - Set "1" to display bookings of the current user only. Default value is "0". Note: this parameter was introduced in version 1.6.1.
[cm_booking_list calendar_slug=calendar_test list_title="Booking List" events_count=3]
Here we set the needed calendar, set the title "Booking List" that should be displayed, and set the number of displayed events - 3. Here is how it will look like in the front-end: