Browse docs
Shortcodes and template functions
Place Tempo's surfaces anywhere, and build theme chrome with the helper functions.
Every member-facing surface has a shortcode and a matching PHP template function, so the flows work in the block editor, classic editor, and page builders (Oxygen and friends) alike.
The surfaces
| Shortcode | Template function | Renders |
|---|---|---|
[dsb_booking] | dsb_booking() | The guided booking flow |
[dsb_register] | dsb_register() | The teacher register |
[dsb_help] | dsb_help() | The Need help page |
[dsb_child_switcher] | dsb_child_switcher() | The selected-child switcher |
dsb_selected_child_banner() | The "Booking for …" banner |
In a builder template that doesn't process shortcodes, use the function:
<?php dsb_booking(); ?>
One nuance worth knowing: pages placed via the *shortcode* are auto-detected by the plugin's page tracking and the first-login wizard's page takeover. A flow placed purely by template function has no content to detect, so the wizard renders inline there instead, and the page assignments in Settings → General should be set explicitly.
Chrome helpers for theme builders
The functions the matching theme itself is built on; all safe to call from any theme (guard with function_exists() if your theme must also work without the plugin):
- Navigation:
dsb_booking_page_url()anddsb_register_page_url(), the tracked pages for "Book classes" and "My classes" links, anddsb_help_page_url()for the Need help page; the last returns an empty string when no published page hosts[dsb_help], so your theme hides its link rather than pointing at a 404. - The basket pill:
dsb_basket_pill()renders the live "N held · M:SS" pill. Or roll your own from the auto-filled data hooks:[data-dsb-basket](hidden when empty),[data-dsb-basket-count],[data-dsb-basket-clock]. - Branding:
dsb_logo_url()anddsb_logo_url_inverse()(the light logo for dark surfaces; returns an empty string when the club hasn't set one, so fall back to your own asset, never the colour logo),dsb_brand_colour( 'primary'|'secondary' ), anddsb_brand_colour_contrast()/dsb_contrast_text( $hex )for WCAG-readable text on top of brand colours. The same colours are printed as--dsb-*custom properties on:root, including on-brand text colours. - Vocabulary and identity:
dsb_vocab( 'class'|'classes'|'student'|'students'|'teacher'|'teachers'|'term'|'terms' )so your theme's copy follows the club's words;dsb_business_name()anddsb_business_type( 'singular'|'plural' ). - Audience:
dsb_is_teacher()(anddsbBooking.getState().isTeacherin JS) to collapse navigation for register users;dsb_login_panel_image_url()for themes supporting the login image.
The registration bridge
Theme-owned public registration builds on two functions: dsb_registration_available() (is the plugin present and accepting public registrations?) and dsb_register_member( array $data ), which accepts only student or parent account types and returns the created account IDs or a WP_Error. The plugin owns the actual account creation, transactional rollback and the deferred set-password email; your form owns its own markup, nonce and abuse controls. Public requests can never attach existing accounts; existing-record links remain staff-only by design.
The front-end JS API
The booking script installs window.dsbBooking:
dsbBooking.getState(); // {basketCount, soonestExpires, student, isTeacher, helpUrl}
dsbBooking.refresh(); // re-fetches state
dsbBooking.on(cb); // fires on every state change
Notices dispatch as DOM events where no server render exists to hook: dsb:hold-expired and dsb:register-notice on document, each with a detail payload carrying channel, tone, title and text; the copy stays plugin-owned, your theme only presents it.
Thanks. That helps us improve these guides.
Thanks for letting us know. Ask us on the Support page and we'll help directly.