A Divi 5 module that shows upcoming events from The Events Calendar as a carousel, one event at a time: the featured image on the left, and on the right the title with the date and time under it. The whole card links to the event; on a phone the image stacks above the text. The carousel moves to the next event every 5 seconds by default, wrapping from the last back to the first, and pauses while a visitor hovers over or focuses it, or the tab is hidden. Previous / next buttons move it one event at a time, as do swipe, trackpad and the arrow keys when it has focus.
Requires Divi 5 (developed against 5.19.0) and The Events Calendar (6.x). PHP 8.6+.
| Panel | Group | Setting |
|---|---|---|
| Content | Events | Number of events, event category slugs (comma-separated), featured only, date format (blank = the site language's regional format), show time, "no events" text |
| Content | Carousel | Loop, auto scroll (on by default), auto scroll interval in seconds (default 5), show previous / next buttons |
| Design | Event Card | Background, border, box shadow |
| Design | Image | Border, filters |
| Design | Title Text / Date Text | Full Divi font controls (title heading level defaults to H3) |
| Design | Previous / Next Buttons | Arrow colour, background, border, box shadow |
| Advanced | The usual Divi options, plus Custom CSS for track, card, image, title, date and buttons |
Only public events that have not ended are shown, soonest first: published (never drafts, pending, scheduled or private events), not password-protected, and not marked "Hide From Event Listings" in The Events Calendar. Past events never appear.
Dates follow the site language's regional format (Settings → General → Site Language),
through PHP's intl extension: the locale decides the order of day and month, 12- or 24-hour
time and the punctuation. For English (UK):
- Same day:
Fri, 20 Nov 2026, 19:00–21:30 - All day:
Fri, 20 Nov 2026, all day - Multi-day:
Sat, 21 Nov 2026, 19:00 – Mon, 23 Nov 2026, 16:00
and for English (US) Fri, Nov 20, 2026, 7:00 PM–9:30 PM. A module's own Date Format field
(a PHP date format) overrides this, and a server without intl falls back to the Date and
Time Formats in Settings → General.
A carousel with only one event shows that event with no previous / next buttons and no auto scroll.
Filters: whats_on/query_args (arguments passed to tribe_get_events()) and
whats_on/image_size (default large). Kill switch: define( 'WHATS_ON_KILL', true );
in wp-config.php.
whats-on.php plugin header + bootstrap
modules-json/events-carousel/ module.json: Divi 5 metadata, attributes and settings panels
src/ PHP (namespace WhatsOn\)
Plugin.php hooks
Assets.php front-end + Visual Builder asset registration
Divi/EventsCarouselModule.php Divi render callback, classnames, styles
Events/ query options, TEC repository, date formatting
Render/ carousel markup (no Divi/WP dependency, unit-tested)
Rest/EventsController.php GET /wp-json/whats-on/v1/events (builder preview data)
Support/Attrs.php typed reads from Divi attributes, meta and options
assets/src/frontend/ carousel behaviour + CSS (shared with the builder)
assets/src/builder/ Visual Builder module (React edit renderer)
assets/build/ compiled output (committed so the plugin runs without a build)
tests/php/ Pest over wp-mocks (the suite's shared WordPress doubles)
tests/js/ Vitest + jsdom
tests/phpstan/ PHPStan stubs for the parts of Divi 5 and TEC the plugin calls
bin/dev.ps1 Local site helper (link, seed, WP-CLI, Composer)
bin/seed.php sample events + demo page
build.php the suite's build script: npm assets, then the release zip
How the Divi 5 parts fit together:
- PHP registers the module on
divi_module_library_modules_dependency_treewithModuleRegistration::register_module()and renders it withModule::render(). - The builder bundle is registered on
divi_visual_builder_assets_before_enqueue_scriptsthroughPackageBuildManager, and registers the module on thedivi.moduleLibrary.registerModuleLibraryStore.afterhook. Its settings panels are generated frommodule.json("settings": { "content": "auto", ... }), so the JS only supplies the edit renderer and styles. reactand@divi/*imports are mapped to Divi's globals (window.vendor.React,window.divi.module, …) bybuild.mjs. Nothing from Divi is bundled.- The builder preview fetches the same events through the REST endpoint (editors only), and uses the same carousel script as the front end.
The dev environment is the aa-bristol-future site in Local,
which has Divi 5 and The Events Calendar. Start it in Local first. To use a different
Local site, pass -Site <name> or set WHATS_ON_SITE.
npm run dev:setupThat command installs the JS dependencies, builds the assets, and junctions
wp-content/plugins/whats-on to this checkout. It then activates the plugin and seeds the
site. After that, edits here are live on the site.
bin/dev.ps1 reads the site's PHP, php.ini and MySQL port from Local's own config and uses
Local's bundled WP-CLI and Composer, so nothing else needs installing. Run it with pwsh
(PowerShell 7). Windows PowerShell 5 blocks unsigned scripts by default.
| Command | Does |
|---|---|
pwsh bin/dev.ps1 info |
Resolved paths and URLs |
pwsh bin/dev.ps1 seed |
13 sample events (one past, one all-day, one multi-day, one without an image, two featured, three categories, and four upcoming but not public: private, draft, password-protected and hidden from listings) and two demo pages: /whats-on-demo/ (the module's defaults) and /whats-on-demo-single/ (one event, centred). Re-running replaces them |
pwsh bin/dev.ps1 reset |
Removes the sample data only. Everything seeded is tagged _whats_on_sample |
pwsh bin/dev.ps1 wp … |
Any WP-CLI command against the site |
pwsh bin/dev.ps1 composer … |
Local's Composer, run in this checkout |
pwsh bin/dev.ps1 unlink |
Removes the junction (with rmdir, never a recursive delete) |
Day to day:
npm run watchThe first time, install the PHP dependencies with pwsh bin/dev.ps1 composer install.
- Front end: http://aa-bristol-future.local/whats-on-demo/
- Builder: http://aa-bristol-future.local/whats-on-demo/?et_fb=1
CI runs all of these on every PR, on PHP 8.6. Run them locally through
bin/dev.ps1, so Composer and every tool it starts use Local's PHP:
| Command | Gate |
|---|---|
pwsh bin/dev.ps1 composer test |
Pest, over wp-mocks |
npm test |
Vitest (carousel behaviour, builder attribute parsing) |
pwsh bin/dev.ps1 composer phpstan |
PHPStan level 9 with the WordPress extension, no baseline |
pwsh bin/dev.ps1 composer phpcs |
PSR-12 (composer phpcs:fix applies the automatic fixes) |
pwsh bin/dev.ps1 composer build:production |
Builds the release zip; CI also checks assets/build is current |
CI also runs composer validate, composer audit, npm audit, a PHP lint and
Semgrep, and uploads coverage to Coveralls (advisory).
Merging to main is the release, as for every suite plugin. After the gates pass, CI:
- derives the level from the commit prefixes since the last
v*tag (feat!→ major,feat:→ minor, anything else → patch); - writes the new version into the
whats-on.phpheader; - runs
composer build:production, which builds the assets, syncs the version intoreadme.txtand the README badge, and writesbuild/whats-on-production-<version>.zip; - commits that as
chore(release): vX.Y.Z [skip ci]and publishes a GitHub Release with the zip.
/deploy test whats-on then installs it. To release without a merge, run the CI
workflow manually (workflow_dispatch).