Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured Event Data: Include the Event details on past years #1329

Open
wants to merge 3 commits into
base: production
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions public_html/wp-content/mu-plugins/structured-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ function get_event_status( WP_Post $wordcamp ) {
require_once WP_PLUGIN_DIR . '/wcpt/wcpt-event/class-event-loader.php';
require_once WP_PLUGIN_DIR . '/wcpt/wcpt-wordcamp/wordcamp-loader.php';

$active_statuses = WordCamp_Loader::get_active_wordcamp_statuses();
$active_statuses = array_merge(
WordCamp_Loader::get_active_wordcamp_statuses(), // Pre-schedule + Scheduled.
WordCamp_Loader::get_public_post_statuses() // Scheduled + Closed.
);

if ( 'wcpt-cancelled' === $wordcamp->post_status ) {
$status = 'https://schema.org/EventCancelled';
} elseif ( in_array( $wordcamp->post_status, $active_statuses, true ) ) {
$status = 'https://schema.org/EventScheduled';
} else {
// There isn't an `eventStatus` for completed events, they only want to show ones that are upcoming.
// @link https://schema.org/EventStatusType
// @link https://developers.google.com/search/docs/appearance/structured-data/event#structured-data-type-definitions.
return false;
}

Expand Down
Loading