A day-by-day tour programme block with stops and times that adds
schema.org TouristTrip structured data to the page. Built for the
WordPress.org Block Directory: one block, no settings page, no external
service, minimal PHP.
The structured data comes from
tourist-trip-schema.
WordPress.org listing text lives in readme.txt.
- Editor (
src/edit.js) builds the JSON-LD with the library whenever the inputs change and stores it in theschemaattribute. Invalid input shows a warning and stores nothing. - Saved markup (
src/save.js,src/timeline.js) is the visible timeline. The editor preview uses the same component. src/render.phpprints the saved markup plus the stored JSON-LD, completed with page values (title when the block has no name, permalink, featured image). It builds nothing itself.- kses: for users without
unfiltered_html, WordPress turns "&" into "&" inside block attributes. Every read decodes entities (clean()insrc/data.js,tour_itinerary_decode()in PHP), so the round trip is stable. Tested with an Author account inwp-env. Known limit: for those users kses also strips text that looks like a tag (<6) from the structured data; the visible text is not affected.
npm install
npm run build # build/ is what WordPress loads
npm test # Vitest
npm run lint:js && npm run lint:css
npm run env start # WordPress at http://localhost:8888 (admin / password), needs Dockertourist-trip-schema comes from npm. To try an unreleased library change,
temporarily install it from a local checkout (npm install ../tourist-trip-schema)
and do not commit that.
- Bump the version in
tour-itinerary.php,src/block.json,package.jsonandreadme.txt(Stable tag), add a changelog entry. - Push a tag such as
0.1.0..github/workflows/deploy.ymldeploys to WordPress.org SVN (secretsSVN_USERNAME,SVN_PASSWORD).
The first version has to be submitted by hand at
https://wordpress.org/plugins/developers/add/ and pass review before SVN
access exists. Directory assets (icon, banner, screenshots) go into
.wordpress-org/.
GPL-2.0-or-later. Made by Your Next Tours.