Skip to content

Booking-button contract

Any element with data-gm-form="1" opens the GymMark booking pop-out when clicked. Optional data-gm-* attributes pass context: which form to show, and which program, location and class session the visitor clicked.

Attribute Value Effect
data-gm-form 1 Required. Marks the element as a booking trigger.
data-gm-form-id gym_form post ID Show this form instead of the resolved one.
data-gm-offer-id gym_offer post ID Show this offer in the pop-out.
data-gm-program-id Program (classes) post ID Context for form, offer and review matching.
data-gm-location-id locations post ID Context for form, offer and review matching.
data-gm-program Program name Pre-selects the program field; part of the selected session.
data-gm-day Display text, e.g. Fri, Oct 16 Part of the selected session.
data-gm-time Display text, e.g. 6 a.m. Part of the selected session.
data-gm-coach Instructor name Part of the selected session.
data-gm-hide-coach 1 The source hid instructors: the selected session and its Change picker leave the coach out.

The day, time, program and coach values fill the form’s Selected session field (when the form has one) and are submitted with the lead.

echo gymmark_form_trigger_button(
'Book a free class', // label (defaults to "Get started")
array(
'program_id' => 123,
'location_id' => 456,
'program' => 'Barre',
'day' => 'Fri, Oct 16',
'time' => '6 a.m.',
'coach' => 'Jane Coach',
),
'my-extra-class' // optional extra CSS class
);

It outputs an <a class="gm-book-form" href="#start" data-gm-form="1" …> link. Empty values are left out. The context keys are program_id, location_id, form_id, offer_id, program, day, time, coach and hide_coach.

When Button takeover is on (option gymmark_forms_generic_triggers, default on), these also open the pop-out: a[href$="#start"], a[href$="#book"], .start and .book. They carry no context unless you add data-gm-* attributes. When it’s off, only [data-gm-form="1"] opens the pop-out.

Triggers do nothing for visitors who can’t see forms; see Forms mode (option gymmark_forms_mode: off, admins, live).