Skip to content

Instantly share code, notes, and snippets.

@robwent
Created April 24, 2019 21:28
Show Gist options
  • Save robwent/f921db818921073aa454c06b87c94023 to your computer and use it in GitHub Desktop.
Save robwent/f921db818921073aa454c06b87c94023 to your computer and use it in GitHub Desktop.
Extends Yoast schema to add event data
<?php
include ("classes/Schema_Event.php");
add_filter( 'wpseo_schema_graph_pieces', 'PREFIX_add_graph_pieces', 11, 2 );
/**
* Adds Schema pieces to our output.
*
* @param array $pieces Graph pieces to output.
* @param \WPSEO_Schema_Context $context Object with context variables.
*
* @return array $pieces Graph pieces to output.
*/
function PREFIX_add_graph_pieces( $pieces, $context ) {
$pieces[] = new Schema_Event( $context );
return $pieces;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment