Skip to content

Show event and venue details in post embeds - #2653

Open
faisalahammad wants to merge 1 commit into
GatherPress:developfrom
faisalahammad:feature/2038-event-venue-embeds
Open

faisalahammad wants to merge 1 commit into
GatherPress:developfrom
faisalahammad:feature/2038-event-venue-embeds

Conversation

@faisalahammad

Copy link
Copy Markdown
Contributor

Fixes #2038

Proposed changes:

  • Embedded events and venues used the generic WordPress embed (title, excerpt, site name), so they looked like any other post. A new Embed class hooks embed_content and adds the details that matter.
  • Event embed: date and time, venue name and address, an "Online event" line, a note when the event has passed or is canceled, and an RSVP link that opens the event page in the full window (target="_top"). The RSVP link only shows for upcoming events whose post type declares gatherpress-rsvp.
  • Venue embed: address, phone and website. Empty fields are left out. The website is plain text, because core's wp-embed.js ignores clicks on links to another host.
  • The check uses post_type_supports() (gatherpress-event-date and gatherpress-venue-information), so custom event and venue post types get the same embed.
  • Venue data comes from Event::get_public_venue_information(), so a password-protected venue does not leak its address. A password-protected event shows no details at all, same as core hides its excerpt.
  • A small stylesheet (build/embed_style.css) loads on enqueue_embed_scripts, only when the embedded post is an event or venue.

Other information:

  • Have you written new tests for your changes, if applicable?

AI assistance

  • An AI tool wrote a significant part of this change.

Testing instructions:

  1. Create a venue with an address, phone and website, and publish it.
  2. Create an event a week from now, assign the venue, and publish it.
  3. In a new post, paste the event URL on its own line (or use an Embed block) and preview.
    Expected: under the excerpt you see "Date:", "Venue:" with the address, and an "RSVP" link. Clicking RSVP opens the event in the full window.
  4. Turn on Online event for the event and reload. Expected: an "Online event" line.
  5. Embed a past event and a canceled event. Expected: "This event has passed." or "This event is canceled.", and no RSVP link.
  6. Embed the venue URL. Expected: "Address:", "Phone:" and "Website:" lines, empty fields hidden.
  7. Give the event a password. Expected: no event details. Remove it and give the venue a password instead. Expected: date shows, venue name and address do not.
  8. Embed a normal blog post. Expected: same embed as before, and no embed_style.css in the iframe source.

Credit (for release notes)

My WordPress.org username: faisal03

Changelog entry

  • Automatically create a changelog entry from the details below.

Changelog entry added manually in .github/changelog/2038-event-venue-embeds.

- Add Embed class that prints event or venue details in post embeds.
- Event embed shows date, venue, online, past or canceled state and an RSVP link.
- Venue embed shows address, phone and website.
- Load a small embed stylesheet only for events and venues.
- Add unit tests and a changelog entry.

Fixes GatherPress#2038
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props faisalahammad, mauteri.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown
Contributor

Preview changes with Playground

Customize PR Playground

To customize the Playground preview for this specific PR, create a file at:

.github/playground/PR-2653-blueprint-override.json

The override is merged into the generated blueprint and can be used to:

  • Enable Playground features
  • Install additional plugins
  • Change site options
  • Run steps before or after the GatherPress' default steps

Example:

{
	"$schema": "https://gatherpress.org/playground-preview/pr-override-schema.json",
	"landingPage": "/wp-admin/edit.php?post_type=gatherpress_venue",
	"siteOptions": {
		"show_on_front": "page"
	},
	"features": {
		"networking": true
	},
	"prependSteps": [
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "simple-location"
			},
			"options": {
				"activate": true
			}
		}
	],
	"appendSteps": [
		{
			"step": "runPHP",
			"code": ""
		}
	]
}

Go to Playground PR preview customization for more details.

You can preview the recent changes for PR#2653 with the following PHP versions:

PHP Version 8.4

PHP Version 8.2

PHP Version 8.1

Download .zip with build changes

Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions.

@github-actions

Copy link
Copy Markdown
Contributor

Test Coverage Report

✅ All coverage checks passed!

✅ PHP Coverage
=== PR Coverage Check ===

Configuration loaded:
  Minimum coverage: 100%
  Exclude patterns: 47 patterns
  Low coverage exceptions: 0 files

Checking coverage for files changed from origin/develop...

Found 5 changed PHP file(s):
  - includes/core/classes/class-embed.php
  - includes/core/classes/class-setup.php
  - includes/templates/embed/event.php
  - includes/templates/embed/venue.php
  - test/unit/php/includes/tests/core/classes/class-test-embed.php

Files requiring coverage check: 2
  - includes/core/classes/class-embed.php
  - includes/core/classes/class-setup.php

✅ Loaded coverage.xml
✅ Loaded coverage-multisite.xml

✅ includes/core/classes/class-embed.php - 100% coverage (53/53 lines)
✅ includes/core/classes/class-setup.php - 100% coverage (202/202 lines)

=== Summary ===
✅ Passed: 2 file(s)
⏭️  Excluded: 3 file(s)
❌ Failed: 0 file(s)

✅ All changed files meet the minimum coverage requirement of 100%
✅ JavaScript Coverage
=== PR JavaScript Coverage Check ===

Configuration loaded:
  Minimum coverage: 100%
  Exclude patterns: 47 patterns

Checking coverage for JavaScript files changed from origin/develop...

✅ No JavaScript files changed in this PR.

This comment is automatically updated on each push.

@mauteri mauteri added this to the 0.38.0 milestone Nov 17, 2026

@wppoland wppoland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Keying Embed::get_details_markup() and Embed::enqueue_style() off post_type_supports() for Event::SUPPORT, Venue::SUPPORT, and Rsvp::SUPPORT works nicely for both default and custom post types. Using get_public_venue_information() and checking post_password_required() ensures cached embed iframes never leak protected or non-public data, and the unit test coverage in Test_Embed is thorough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Event and venue embeds render as generic posts

3 participants