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_status - Used for displaying the list of upcoming bookings filtered by the status. Default value is "all". Possible values are "accepted", "new" and "paid". The value "paid" displays the bookings with the status "Waiting for payment" and demands the add-on CM Appointments Booking Payments Pro to be activated. Note: this parameter was introduced in version 2.2.2.
- 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=5]
Here we set the needed calendar, set the title "Booking List" that should be displayed, and set the number of displayed events - 5. Here is how it will look like in the front-end:
4) User Dashboard for Time Credits
Use: This shortcode is used for displaying the User Dashboard for users with time credits. The dashboard can be access only by logged-in users.
Note: This shortcode was introduced in version 2.2.0. Learn more about Time Credits feature in this guide: Appointments Booking - Use Case - How to Set Up User Time Credit
5) Tiles View of Calendars
Use: This shortcode
[cm_calendars_tile_list] is used for displaying all calendars in a tiles view. Each tile shows the name, description and image of the calendar. Clicking on a tile opens a page with the relevant calendar.
Important! By default, calendars that you create don't have their own pages. They can be displayed anywhere using a shortcode with the calendar ID. The tiles view feature works in a different way: you just need to create in advance only one special page that can open needed calendar. That special page should contain a shortcode
When you created the page with the shortcode
[cm_calendar_get_page], you need to get the ID of this page, then navigate to Admin Dashboard → CM Appointments Booking Pro → Options → Plugin Options tab. Find there the option Set Calendars output page ID, put there page ID and save changes.
Note: These shortcodes were introduced in version 2.2.5. Learn more about Tiles View feature in this guide: Appointments Booking - Calendars - Tile View Catalog of Calendars