Skip to main content

Directory Theme class reference

19 min read

Booking Theme — Class reference

The 29 classes that make _bo behave differently from the shared Directory core. Generated from the theme source.

← Back to Booking Theme features

DemoAccounts DemoAccounts.php​

Booking — what the one-click DEMO member walks into. The Booking Theme's home-demo offers one "members area" login: the plain test member (Account\DemoLogin, no account types). Its hub shows BOTH sides of the product, because both are what a buyer of the theme comes to see (owner's call, 2026-10-02): A demo site needs no listings (owner's ruling, 2026-10-02): every public page is virtual, so the services this hub needs are BUILT for it (DemoLogin::createRowsFor - demo-marked, deleted at go-live), never borrowed from a seeded catalogue. PROVIDER. The member gets one service of its own. Guest clients have booked it: two requests waiting for a reply (the Confirm / Decline buttons and the "awaiting your reply" to-do), two confirmed appointments coming up and three completed ones. CUSTOMER. A second throwaway account (a provider, self::PROVIDER) gets three services, and the member has booked them: one confirmed and paid (its receipt is under Invoices), one request still waiting for the provider, and two completed visits, one of them reviewed (a verified-booking review). Three services are saved to Favorites. Every booking is written exactly as the engine stores a real one (Bookings::create's columns, a real open slot from the listing's hours via Bookings::candidateStarts) but straight to the table: create() refuses past dates and e-mails the owner, neither of which a fixture wants. Everything is recorded on the member (self::META) and removed by unfurnish() when DemoLogin purges the account at go-live; the built services go with their accounts (DemoLogin::purge drops a throwaway account's demo rows).

API
register()metaKey()furnish()unfurnish()
inc/_bo/DemoAccounts.php

Expiry Expiry.php​

PPT — listing expiry / "Listing lifetime". The Settings ▸ Listings "Listing lifetime" (days) governs how long a listing stays live. 0 = never expires. A value > 0 stamps an expiry timestamp on each listing when it's published; a daily cron then runs the configured "On expiry" action (listings_expiry_action: nothing / draft / pending / trash) once the time is up. The expiry timestamp meta is SHARED with the pricing-plan expiry (PricingPlans::LISTING_EXPIRES_META). A listing that carries a pricing plan is governed by that plan's own duration (set in the editor / at checkout), so the global lifetime only applies to listings WITHOUT a plan. Either way, the cron here enforces whatever expiry timestamp a listing ends up with, and both editors show the time remaining.

API
register()metaKey()schedule()unschedule()onTransition()applyLifetime()runCheck()timestamp()remaining()dateLabel()
inc/_bo/Expiry.php

Single-listing gallery styles. The admin picks one of four layouts on the Design ▸ Listings tab (stored in the ppt_design option via Branding), and the single-listing template renders the chosen layout for the listing's images. standard — large hero photo + thumbnail strip (click to swap) [default] grid — all photos in a tiled grid (first one featured) carousel — a swipeable/scroll-snap slider with prev/next tall — full-width photos stacked vertically (good for portraits)

API
styles()locked()current()isFullSpan()render()css()
inc/_bo/Gallery.php

Geocoder Geocoder.php​

Bulk geocoder — fills in lat/lng for existing listings that have an address but no coordinates (e.g. listings created before the editor's map picker existed), so they get a precise map marker and the "Distance from me" feature. Uses the site's Maps provider (Settings ▸ API keys): Google / Mapbox geocoding APIs (their key), or OpenStreetMap Nominatim (keyless, rate-limited to ~1 req/sec with an identifying UA). A small box on the PPT Listings screen runs it in batches over AJAX. Listings that can't be geocoded are flagged (_ppt_geo_failed) so they aren't retried forever.

API
register()geocode()pendingCount()ajaxBatch()assets()box()
inc/_bo/Geocoder.php

ListingActions ListingActions.php​

Per-listing visitor actions shown on the single-listing section nav: - Add to favorites — toggles the listing in the member's saved list (user meta ppt_favorites); the account page shows them. Logged-in only; guests are routed to sign-in. - Report — flags the listing to the site admin. The reason is stored as a comment on the listing (type ppt_report, a custom approval status so it stays hidden from the front-end and the normal comment-moderation tabs) and also emailed to the admin. Reports are reviewed in the admin Comments screen's dedicated "Reports" tab. Open to guests and members.

API
register()favIds()favHas()favToggle()favListingIds()ajaxFav()ajaxReport()assets()favButton()reportButton()
inc/_bo/ListingActions.php

ListingCard ListingCard.php​

The canonical listing card — the single, theme-wide way a business/listing is shown as a card. Every directory surface (search results, single-page "related", and the live listing-grid blocks) renders through here, so a listing looks the same everywhere and the demo-vs-live data split lives in ONE place. Data-source agnostic: fromPost() maps a real listing_type record and fromSample() maps a curated demo row into the same normalized shape, which render() draws. The markup is built on the theme design tokens, so the one card automatically adopts each design's colours/fonts. Its CSS is enqueued site-wide (assets/css/listing-card.css) — the card only emits markup. Normalized shape: name, link, img, cat, rating, desc, desc_long, price, city, dist, featured (bool), highlighted (bool), badge (string), id badge is an optional ribbon label (e.g. "New") for callers that need one; when empty it falls back to "Featured" if featured is set.

API
fromPost()serviceFields()fromSample()render()
inc/_bo/ListingCard.php

ListingEditor ListingEditor.php​

Listing editor — the shared brain behind the two listing-edit screens: - Admin : PPT-styled screen at ?page=ppt_listings&edit=<id> (Chrome shell), rendered by Admin\Listings when the edit param is present. - Member : front-end screen at /account/listing/<id>/ inside the Member Hub, rendered by Account\MembersPage for a listing the member owns. Both POST to admin-post.php (action ppt_listing_save) and run through the one save() below, so the field set, sanitising and persistence live in a single place. The mode (admin|member) decides which extras are honoured: admins get status, author, slug, featured/verified and the "edit only" custom fields; members get a friendly subset scoped to their own listing. Fields = core (title, description, category, tags, featured image, gallery, FAQ) + every field defined in the Custom Fields admin (Admin\Fields / option ppt_fields), stored as post meta keyed by the field key — which is what the single-listing template already reads.

API
register()defaultBookingProvider()newUrl()handleNew()submissionsOpen()memberCanAdd()canEdit()adminEditUrl()memberEditUrl()applicableFields()locationKeys()coordKeys()mapPickerReady()mapConfig()locationFields()socialNetworks()socialValue()socialIcon()hoursDays()hoursValue()normTime()money()untitledTitle()plainText()
inc/_bo/ListingEditor.php

ListingFaq ListingFaq.php​

Single-listing FAQ. Reads per-listing FAQ items from the faq post meta (an array of ['q' => …, 'a' => …]). A live listing shows only its own saved FAQ — when it has none the section is omitted rather than filled with fabricated entries. Demo/preview mode supplies sample FAQ via DemoContent so a fresh design isn't empty. Populate a listing's own FAQ by saving faq meta, inject a site-wide default set via the ppt_listing_faq_default filter, or adjust the final list with the ppt_listing_faq filter.

API
items()
inc/_bo/ListingFaq.php

ListingHours ListingHours.php​

Business hours display for the single-listing sidebar. Reads the business_hours meta written by the listing editor (ListingEditor::HOURS_META) and renders a Google-Business-style day list with an "Open now / Closed now" badge computed in the site's timezone. Times are formatted with the site's time format.

API
has()isOpenNow()renderSidebar()
inc/_bo/ListingHours.php

ListingLocation ListingLocation.php​

Single-listing "Location" section — the richer location block: the full formatted address, an interactive map (ListingMap, precise when the listing has coordinates), a "Get directions" button, and a "Distance from you" control (browser geolocation → straight-line distance to the listing). Self-contained: it prints its own scoped CSS + JS once, so single.php just calls render().

API
address()coords()has()render()
inc/_bo/ListingLocation.php

ListingMap ListingMap.php​

The single-listing "Location" map. Uses the site's Maps provider setting (Settings ▸ API keys — the same ppt_maps_provider filter the search map reads). When the listing has stored coordinates (lat/lng, set by the editor's map picker) the map centres on them precisely and drops a named marker; otherwise it falls back to geocoding the address string: google / mapbox(fallback) → a keyless Google Maps embed osm → a Leaflet map (marker from coords, else Nominatim) Map libraries load from their CDNs — the owner-approved front-end map exception.

API
render()
inc/_bo/ListingMap.php

ListingPricing ListingPricing.php​

Single-listing pricing plans. A listing owner enters one or more plans / packages on the submission form (a name, a price, and a short description); they're stored in the pricing_plans post meta as a list of ['name' => …, 'price' => float|null, 'desc' => …]. The LOWEST priced plan is mirrored into the searchable price meta (Ppt_bo\SearchPage::PRICE_META) by the editor on save, so the price range filter, the price sort, and the result-card price all work — that's the link between "enter your pricing" and "find listings by price". Prices are stored in the site's base currency; render() converts + formats via Ppt\Content\Currencies for the viewer's chosen currency.

API
plans()demoPlans()has()lowestPrice()normalise()render()
inc/_bo/ListingPricing.php

ListingSections ListingSections.php​

PPT — configurable single-listing sections. The admin (Design ▸ Listings ▸ "Listing page sections") gets a sortable list of on/off toggles for the optional feature blocks a listing page can carry — Booking, Business hours, Maps & Location, FAQ, Reviews. Turning one OFF removes it from BOTH the single listing page and the listing submission/edit form; the order of the list controls the order the (main-column) sections appear in. Config lives in the shared design option (Branding::OPTION = ppt_design) under the listing_sections key: { order:[keys…], enabled:{key:0|1} }. Anything not saved yet defaults to ON, in the catalog order — so existing sites are unchanged until the admin edits the list.

API
supported()catalog()config()order()enabled()orderedAmong()sanitize()
inc/_bo/ListingSections.php

ListingTeam ListingTeam.php​

The listing page's "Team" section (Booking Theme, owner 2026-10-01). The listing's staff roster (Directory\ListingEditor::bookingStaff(): name, photo, role, short bio, stable key) drawn as an avatar grid — round photo, name, role, star rating with review count (or "New"), a Book button and a "Reviews" link. Like Fresha. - Book selects that person in the booking box ("Who with?"), reloads their free times and scrolls to it (booking.js, [data-bk-staff]). - "Reviews" filters the review list to that person (inline script below). - The bio shows when the card is hovered, focused or tapped. Ratings come from reviews that name the person (comment meta Reviews::STAFF_META): a review linked to the reviewer's completed booking carries that booking's staff member automatically and is marked verified; anyone else may pick "Who did you see?" on the form (counts, not verified). See Ppt_bo\Reviews::linkBooking().

API
has()stats()render()
inc/_bo/ListingTeam.php

ListingViews ListingViews.php​

PPT listing analytics — records a "hit" every time a single listing page is viewed, and serves that data back to the listing owner as a graph in the member area (/account ▸ My listings ▸ the analytics icon). Each view stores the listing id, the timestamp (UTC), and — when the visitor is logged in — their user id + display name, so an owner can see who has been looking. Bots/crawlers are skipped so counts reflect real visitors. The owner (and admins) can read the analytics for a listing over the AJAX endpoint, which returns a daily series (for the chart), rolling-window totals (7/30/60/90 days) and a list of recent named viewers. Storage: a custom table {prefix}ppt_listing_views (dbDelta on init).

API
register()table()install()maybeRecord()total()countSince()series()recentViewers()ajaxData()
inc/_bo/ListingViews.php

Media Media.php​

Listing images — the single, WordPress-native resolver for the PPT image system. A listing's photos are its WP featured image (primary) plus any image attachments parented to it (the gallery). No legacy ?imgid refs, no image-URL meta strings — everything flows through the media library.

API
primary()gallery()videos()media()counts()
inc/_bo/Media.php

PackageCheckout PackageCheckout.php​

Session-package checkout (Booking Theme, _bo) — buying a "5 sessions for £180" bundle. A sibling of Ppt\Bookings\Checkout and Ppt\Credits\Checkout, not a modification of either: same shared machinery (the ppt_payment_gateways registry, the ppt_gateway_start / ppt_gateway_verify filter contracts, the ppt_orders CPT and the /checkout/ + /callback/ virtual pages), with its own PKG- order prefix so Pages::content() routes the callback here. Flow: the buyer hits buyUrl() → renderCheckout() validates the offer is still on sale and raises (or reuses) a pending order → they pick a gateway → the /callback/ return verifies it, completes the order and calls Packages::grant(), which is idempotent per order so a double verify can't hand out the sessions twice. Sessions are granted on payment only. Nothing is held or reserved beforehand: unlike a booking, a package takes no slot, so an abandoned checkout costs nobody anything and needs no hold-release sweep.

API
register()buyUrl()coupon()totals()callbackUrl()isPackageRef()markPaid()handlePay()renderCheckout()renderCallback()
inc/_bo/PackageCheckout.php

Packages Packages.php​

Session packages (Booking Theme, _bo) — the "5 sessions for £180" bundle a service owner sells so a client pays once and books repeatedly. Two halves, deliberately separate: - What's on sale : booking_packages post meta on the listing, edited by the owner alongside price and duration. Read via offered(). - What's held : rows in {prefix}ppt_booking_packages, one per purchase, carrying how many sessions it bought and how many are spent. Entitlements are ring-fenced to the LISTING they were bought against: five sessions on "Cut & Finish" book "Cut & Finish", not whatever else the site sells. That is why this doesn't ride on Ppt\Credits\Wallet — the wallet is one flat per-user integer, which on a multi-provider site would let a bundle bought from one business pay another's bill. The grant / spend / refund shape mirrors the wallet's on purpose, so the two read the same way even though the store differs. Sessions are consumed FIFO across a buyer's packages for a listing, so the bundle bought first (and likely to expire first) is drawn down first.

API
register()table()install()offered()offer()sellsPackages()remaining()forUser()grant()consume()usedTotal()restore()label()
inc/_bo/Packages.php

Places Places.php​

World places for the Booking Theme's demo copy (owner 2026-10-01: "most of our clients are going to be in the US — make the home pages non-location-based"). Shared demo sources (SampleListings cards, Social Proof sample events) carry UK cities for every fork; on the Booking profile they are swapped through this map, the same mapping the _bo blocks' own copy was rewritten with. Other forks unchanged.

API
on()world()usCity()sampleCities()
inc/_bo/Places.php

ProviderProfile ProviderProfile.php​

Provider profile fields (Booking Theme, _bo). A booking site's supply is PEOPLE — the therapist, the tutor, the trainer — but everything the fork ships today is listing-owned: a Service listing carries the duration, price, capacity and staff roster, and bookings hang off the listing. This class adds the missing member-level half: an "Available for booking" opt-in plus the few fields that turn the shared public member profile (Ppt\Account\AuthorProfile, the author archive) into a bookable provider page. Deliberately NOT the same thing as the per-listing staff roster (see Ppt\Bookings\Bookings::staffRoster()). A roster entry is a name on a salon's shift plan; a provider profile is a member account that can be found and booked. They are unlinked in v1 — linking them is a later phase. Note there is also a Ppt\Bookings\Providers, which is unrelated: that one resolves the booking WIDGET provider (built-in / cal.com / Google). Different namespace, different job. The opt-in is DISCOVERY ONLY. It governs whether the member appears in the people search (Ppt_bo\ProviderSearch, /providers/) and whether their public profile reads as a provider page. It does not gate publishing services and it does not gate taking bookings — an existing site upgrades with nothing switched off and nothing to backfill.

API
register()available()isListed()headline()about()cleanBio()country()countryName()hasProfile()serviceIds()serviceCount()hasServices()fromPrice()fromPriceLabel()categoriesFor()recount()onListingChanged()rememberAuthor()onListingDeleted()onListingMeta()ajaxSave()statusLine()settingsCard()
inc/_bo/ProviderProfile.php

ProviderSearch ProviderSearch.php​

Dedicated provider search (Booking Theme, _bo) — /providers/. The listing search (Ppt_bo\SearchPage) searches POSTS: the services on offer. This searches PEOPLE: the members who have switched on "Available for hire" in Member Hub ▸ Hire me AND have at least one bookable service published. Different object, different query engine (WP_User_Query), so it is its own route and template rather than another layout of the listing search. Self-contained rewrite + render, the same pattern as Ppt_fm\FreelancerSearch and Account\MembersPage: ?ppt_providers=1, prettified to /providers/. Filters, all optional and combinable, all GET, all in the top bar: pcat service category — a listing_category term id or slug pq keyword — name, headline or bio prating minimum member feedback score, 1–5 (Ppt\Account\Feedback) pmin / pmax price band, matched against the provider's cheapest service psort newest | rating | price_low | price_high | name Two things separate this from the freelance people search it is modelled on. There is no category taxonomy on the user: a provider's categories are the categories of the services they publish, so the filter resolves a term to an author allowlist (see authorsInCategory()). And the price is not a rate they typed but the cheapest service they offer, cached per-member by ProviderProfile so this query stays a plain meta comparison.

API
register()rewrite()queryVar()url()isPage()maybeRender()documentTitle()bodyClass()heading()val()catId()keyword()minRating()priceBound()sortOptions()sort()hasActiveFilters()paged()authorsInCategory()results()userQuery()card()view()demoCards()
inc/_bo/ProviderSearch.php

RelatedListings RelatedListings.php​

"Related listings" — a row of up to four extra listings shown as FULL listing cards (the same canonical search-result card) underneath the main single listing. Each card links through to that listing. In demo / preview mode it's populated from the previewed design's own on-brand cards (each carrying a virtual demo single URL), so a showroom single page always reads as rich; on a live site it collects other published listings in the same category, and hides itself when there aren't enough to be worthwhile. The card itself comes from the active fork's ListingCard (Theme::forkClass), so the strip always matches that theme's search cards exactly — one shared class serves every fork template that doesn't override it (_ll has its own).

API
items()render()css()
inc/_bo/RelatedListings.php

ReviewExtras ReviewExtras.php​

Reviews upgrade (Booking Theme, owner 2026-10-01, after the competitor teardown). - Aspect scores: three optional 1–5 ratings next to the overall stars — Service, Cleanliness, Value by default, renamable in Settings > Bookings. The summary shows each aspect's average. - Photos: a member may attach up to 4 photos to a review. Uploaded straight away (members only), kept UNATTACHED (post_parent 0) so they never join the listing's own gallery, claimed by the review on submit, and deleted with it. A "Client photos" strip sits over the list and opens a viewer. - Filters + sort: chips (All / Verified / With photos), star rating, service and team member selects, sort Newest / Highest / Lowest, 10 at a time with "Show more". Client-side over the rendered list. - Owner replies: the listing's owner (or an admin) posts ONE public reply under each review, editable/removable, shown as "Response from <listing>". Stored as a child comment of type review_reply, so it never counts towards ratings. Ppt_bo\Reviews calls into this at its render points and on save.

API
register()enabled()aspects()save()onDelete()ajaxPhoto()ajaxReply()canReply()reply()aspectStats()renderAspectSummary()renderFormFields()renderListHead()cardAttrs()renderCardExtras()replyHtml()assets()
inc/_bo/ReviewExtras.php

Reviews Reviews.php​

Listing reviews — built on native WordPress comments so they moderate and store like any comment, but stamped with the comment type "review" (the identifier that distinguishes them from ordinary blog comments in the admin) and a 1–5 star rating saved as comment meta. Reviews are always enabled on the listing CPT. Rendered in the single-listing "Reviews" (summary + breakdown + cards) and "Add Review" (star input + comment form) sections.

API
register()open()stampType()validateReview()saveRating()reviewableBooking()staffName()onCommentChange()onStatusChange()syncPostRating()count()all()stats()stars()renderSummary()renderList()renderForm()
inc/_bo/Reviews.php

SearchPage SearchPage.php​

Server-rendered search / archive for the listing post type — the clean PPT rebuild of DT10's PPT\Custom\Search\SearchPage. Runs the normal WordPress main query (WP_Query) via official hooks (pre_get_posts + template_include) so it is SEO-friendly and every core filter applies. Contexts it owns: - keyword search (/?s=…) - the listing post-type archive (/listing/) - listing category / tag archives Filters (GET, all optional, combinable): s keyword tax-listing_category category term id price1 / price2 min / max price (numeric, price meta) sort featured | popular | newest | oldest | rating | price_low | price_high | title paged pagination

API
register()shapeQuery()nearCoords()radiusKm()distanceFrom()distanceLabel()radiusClausesMain()radiusClauses()featuredOrderClauses()popularOrderClauses()isListingContext()postType()isMapTakeover()categoryTax()terms()taxQueryFromRequest()listingTaxonomies()hasActiveFilters()matchingIds()termCounts()priceMetaQuery()ratingMetaQuery()activeMetaQuery()sortOptions()
inc/_bo/SearchPage.php

SingleListing SingleListing.php​

Single-listing page for the listing_type post type — the clean PPT rebuild of DT10's PPT\Custom\Single\SingleListing. Owns template_include for singular listings and renders its own token-styled template inside the normal main loop. No legacy $CORE / membership plumbing; standard WordPress access rules apply.

API
register()demoBookingProvider()template()related()
inc/_bo/SingleListing.php

Sold Sold.php​

"Sold" status — a shared, cross-theme concept: a listing/item can be marked as sold, which shows a "Sold" ribbon on its card and single page, and (when the admin opts in) drops it from search results. Deliberately thin and fork-agnostic, mirroring the other shared directory helpers: the state is a single post-meta flag (self::META), toggled from the admin and member listing editors. Any fork can adopt it — the visible ribbon is wired per fork (see each fork's ListingCard + the global single template), while the search-hide and the save both run from here so they behave the same everywhere. self::applies() gates which profiles currently expose the toggle.

API
isSold()set()saveFromForm()applies()label()hideFromSearch()searchMetaClause()
inc/_bo/Sold.php

TermMeta TermMeta.php​

Per-term IMAGE + ICON for the listing taxonomies. Adds two custom fields to the native WordPress term add/edit screens (Categories, Tags and any custom listing taxonomy): a media-library image picker and a swatch picker over the theme icon library. The values are stored as term meta and consumed by the live-category blocks (via Blocks\Support\Categories) so an admin can give each category a branded photo and icon instead of the auto-derived listing photo / fallback glyph. Admin-only UI; the read helpers (image()/imageId()/icon()) are safe to call anywhere. Taxonomies are resolved live from the listing post type, so new custom taxonomies get the fields automatically.

API
register()hookTaxonomies()taxonomies()imageId()image()icon()assets()addFields()editFields()save()
inc/_bo/TermMeta.php

Uploads Uploads.php​

Listing media uploads — the AJAX backend for the Uppy uploader on the listing editor (replacing the WordPress media frame). Uppy's XHRUpload posts one file per request to ppt_listing_upload; each becomes a normal WordPress attachment (so Media::gallery()/Media::videos() and the single-listing template keep working). Files are left unattached (post_parent = 0) until the listing form is saved, which parents the final set (ListingEditor::save()). A companion ppt_listing_media_remove deletes a freshly uploaded, not-yet- saved attachment when the user removes it in the editor, so abandoned uploads don't pile up in the media library.

API
register()imageMimes()videoMimes()ajaxUpload()ajaxRemove()ajaxPoster()ajaxPersist()
inc/_bo/Uploads.php