What runs on WordPress, what is embedded, and the embed code.
The tool is hosted on Firebase Hosting (rtf-tft.web.app). The facilitator/ folder stands in for WordPress in this demo.
The tools are linked to, not embedded. Put a button on the WordPress page that opens the facilitator portal in its own tab. The tool keeps its own sign-in; the hosting stops other sites framing it, which protects that sign-in.
<a href="https://rtf-tft.web.app/facilitator/" target="_blank" rel="noopener">Facilitator sign in</a>
The pledge counter can be embedded anywhere. It's public (no sign-in) and shows only the programme-wide totals, live. WordPress: paste into a Custom HTML block.
<div data-tft-tool="counter"></div> <script src="https://rtf-tft.web.app/tft-embed.js" async></script> <!-- options: data-tft-theme="dark" · data-tft-detail="1" (per-session) · data-tft-bg="transparent" -->
Wix (HTML embed) or anywhere scripts aren’t allowed: a plain iframe.
<iframe src="https://rtf-tft.web.app/counter.html" title="Try for Tomorrow pledges" style="width:100%;height:240px;border:0"></iframe>
Everything outside the dashed box is the WordPress page. The box is the embedded widget.
Messages between this page and the widget (postMessage):
1. Add the iframe to the WordPress page:
<iframe id="tft-pledge" src="https://rtfgit.github.io/TFT/pledge-widget.html?provider=demo-college&session=3&run=abc123&cohort=year-9-rugby" title="Try for Tomorrow pledge" style="width:100%;border:0"></iframe>
2. Send it each student (the name is shown, never stored):
// WordPress knows the names; the widget only ever gets the pseudonymous ref. frame.contentWindow.postMessage({ type: 'TFT_SET_STUDENT', student_ref: 'p_a7f3c21b', // stored display_name: 'Jack S.' // shown only, never persisted }, 'https://rtfgit.github.io'); // messages the widget posts back: // TFT_WIDGET_READY · TFT_PLEDGE_SAVED · TFT_STUDENT_SKIPPED · TFT_READY_FOR_NEXT · TFT_HEIGHT // and one more the page may send: TFT_ALL_DONE (everyone has had a turn)
| GitHub Pages (the widget) | WordPress | Firebase |
|---|---|---|
public_widget/ — pledge-widget.html, pledge-widget-app.js, session-config.js, assets/ |
facilitator login & portal pages · the roster (names) · a plugin for roster REST + run orchestration · the iframe embed | runs · pledges (by student_ref) · session content · counters |
facilitator/ and wp-emulator.js are demo stand-ins and are not deployed.
Full contract: public_widget/IFRAME_INTEGRATION.md.
WORDPRESS_BUILD.md in the private repository (ask the RTFxRFL team for access).