GatherPress Tickets Block
A block variation of `core/button` for GatherPress event tickets, with post meta integration and intelligent URL fallback.
by carstenbach · github.com/carstingaxion/gatherpress-tickets · website
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/carstingaxion/gatherpress-tickets/releases/download/0.1.1/gatherpress-tickets.zipReadme
GatherPress Tickets Block
Contributors: carstenbach & WordPress Telex
Tags: block, tickets, theater, events
Tested up to: 6.8
Stable tag: 0.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
A block variation of core/button for GatherPress event tickets, with post meta integration and intelligent URL fallback.
Description
The GatherPress Tickets Block registers a block variation of the WordPress core Button block, giving event organizers a dedicated ticket button that integrates with GatherPress event data — without reimplementing any button functionality.
Architecture
This plugin demonstrates the recommended pattern for extending core blocks via block variations. Instead of creating a custom block that duplicates core/button, it:
- Registers a block variation of
core/buttonwith a custom class, default label, and a placeholder URL. - Adds an InspectorControls panel via the
editor.BlockEditfilter, providing a "Ticket URL" field that stores its value in post meta. - Uses the
render_block_core/buttonfilter on the frontend to replace the placeholder URL with the resolved ticket URL from post meta (with fallback logic).
This means the variation inherits all core/button features for free: color, typography, border, border radius, spacing, width, alignment, and any future improvements to core/button.
Key Features
- Zero Duplication — Inherits all
core/buttonstyling controls and markup natively. - Post Meta Integration — Stores the ticket URL in
gatherpress_tickets_urlpost meta, available via the REST API. - Intelligent Fallback Logic — Falls back to GatherPress venue website URL, then to a "Get tickets at the venue" message linking to the venue term archive.
- Frontend Render Filter — Uses
render_block_core/buttonto inject the real URL at render time. - Variation Detection — Uses
isActivecallback with a CSS class identifier (is-style-gatherpress-tickets). - Admin Column — Displays a green check mark in the post list table when a ticket URL is set.
- Singleton Pattern — Plugin class uses the Singleton pattern for clean architecture.
Editor Experience
- Appears in the inserter as "GatherPress Tickets" with a ticket icon.
- Editable button with default label "Get Tickets".
- Full
core/buttoncontrols: color, typography, border, spacing, width, alignment. - Sidebar "Ticket Settings" panel with a URL field stored in post meta.
Frontend Behavior
- Renders a standard
core/buttonanchor with the resolved ticket URL. - Falls back to venue URL from GatherPress post meta.
- Falls back to the venue taxonomy term archive URL.
- Uses "Get tickets at the venue" as the button label for all fallback scenarios.
- Converts the link to a non-interactive
<span>when no URL is available at all.
Installation
- Upload the plugin files to the
/wp-content/plugins/telex-gatherpress-ticketsdirectory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the Plugins screen in WordPress.
- Add the GatherPress Tickets block (found under the core Button variations) to any post or page via the block editor.
Frequently Asked Questions
Why a block variation instead of a custom block?
Block variations extend existing core blocks without duplicating their code. This means you get all of core/button's features — current and future — for free. It's the WordPress-recommended approach for blocks that are conceptually the same as a core block but with customized defaults or additional behavior.
How does the URL fallback work?
The block stores a placeholder URL (#gatherpress-tickets) in the saved content. On the frontend, a render_block filter replaces this with the actual ticket URL from post meta. If no ticket URL is set, it falls back to:
- The GatherPress venue website URL (from
_gatherpress_venuepost meta). - The venue taxonomy term archive URL (from the
_gatherpress_venuetaxonomy). - A non-interactive
<span>element if no URL is available at all.
In all fallback cases, the button label is replaced with "Get tickets at the venue".
Can I customize the button appearance?
Yes. The variation inherits all core/button styling controls including colors, typography, border, border radius, spacing, width, and alignment.
Is the ticket URL available via the REST API?
Yes. The gatherpress_tickets_url meta field is registered with show_in_rest enabled.
Changelog
0.1.0
- Initial release as a
core/buttonblock variation with post meta integration and render filter. - Intelligent three-tier fallback logic (ticket URL → venue website → venue term archive).
- Admin list table column with ticket URL indicator.
License
This project is licensed under the GPLv2 or later — see the GNU General Public License for details.
Read the full README on GitHub →