Directory / plugin
TargetScore Events Calendar
v1.2.0 · by avtarnanrey
Show a TargetScore club's upcoming events on a WordPress page in a Calendar and List view, with an in-site event detail page.
About this plugin
Given a single Club ID, this plugin displays that club’s upcoming events (fetched from the TargetScore API) in two switchable views:
- Calendar — a month grid with one color per event category and multi-day events shown as continuous bars. A league shows each of its rounds on its own day.
- List — the same upcoming events, chronological.
Clicking an event opens an event detail page rendered inside your site. A Register button opens the external TargetScore registration page in a new tab. A separate sidebar/footer widget shows a compact list of upcoming events.
All API calls are made server-side (proxied + cached via WordPress transients), so nothing hits the browser cross-origin and payloads stay small.
How it works
- Configure a Club ID under Settings TargetScore Events Calendar.
- On activation the plugin creates a published Events page (slug
events) containing the[targetscore_calendar]shortcode. You can rename, move, or delete it freely. -
Add the calendar to any page/post with the shortcode:
[targetscore_calendar]
Optional per-instance default view:
[targetscore_calendar view="list"]. -
The event detail page uses the same page with a
?event={slug}query parameter — no rewrite rules needed. - Add the “TargetScore: Upcoming Events” widget to any sidebar/footer for a compact list.
External services
This plugin connects to the TargetScore API to retrieve the configured club’s public event data, and links to the TargetScore website for event registration.
TargetScore API (api-next.targetscore.com)
The plugin makes server-side GET requests to https://api-next.targetscore.com to fetch:
- club information and event categories/colors —
/clubs/{clubId} - the club’s upcoming events —
/events?clubIds={clubId}&timeframe=upcoming - a single event’s details —
/events/slug/{eventSlug}
These requests are triggered when a visitor loads a page containing the events calendar, list, or the Upcoming Events widget. The only data sent is the Club ID you configure (and, for the detail view, an event reference from the page URL). No personal visitor data is transmitted. Responses are cached in WordPress transients.
The API address is configurable under Settings TargetScore Events Calendar, because this service is moving to https://api.targetscore.com once the previous TargetScore backend is retired.
TargetScore website (targetscore.com)
Event “Register” buttons and links open https://targetscore.com/{eventSlug} in the visitor’s browser (a normal outbound link; no data is sent by the plugin itself).
Service provider: TargetScore.
Terms of Service: https://docs.targetscore.com/docs/legal/terms-of-service
Privacy Policy: https://docs.targetscore.com/docs/legal/privacy-policy
Developer notes
The front-end bundle (assets/js/dist/targetscore-calendar.iife.js + .css) is compiled from assets/js/src/ via esbuild:
cd build
npm install
npm run build # produce the bundle
npm test # run the normalizeEvent unit tests
All event-date parsing lives in one adapter (assets/js/src/normalize.js: normalizeEvent for the event as a whole, normalizeEvents for the calendar entries it draws), mirrored in PHP by targevca_normalize_event() / targevca_normalize_events() in includes/helpers.php for the server-rendered widget. Keep the two in lockstep.
The API address can also be pinned in wp-config.php with define( 'TARGEVCA_API_BASE', 'https://…' ); (which takes precedence over the setting and is shown read-only in the admin), or filtered with targevca_api_base.