Answers to common GeoDirectory questions about events. Click a question to open the answer.
GeoDirectory adds JSON-LD schema to every listing’s details page, but it only fills in the fields it knows about. Google Search Console may then warn that an event is missing offers or performer. You can add both with the geodir_details_schema filter.
- Go to Events > Settings > Custom Fields and add the predefined Price field (its key is
price). - Add a Text field for the performer and give it the key
performer. - Add the snippet below with the Code Snippets plugin, then fill the new fields on your events.
add_filter( 'geodir_details_schema', 'my_gd_event_schema_extras', 20, 2 );
function my_gd_event_schema_extras( $schema, $post ) {
global $gd_post;
if ( empty( $gd_post->post_type ) || 'gd_event' !== $gd_post->post_type ) {
return $schema;
}
// Price field (key: price).
if ( ! empty( $gd_post->price ) ) {
$schema[<span></span>'offers'] = array(
'@type' => 'Offer',
'price' => $gd_post->price,
'priceCurrency' => 'USD', // Change to your currency code.
'availability' => 'https://schema.org/InStock',
'url' => $schema[<span></span>'url'],
);
}
// Text field with the key: performer.
if ( ! empty( $gd_post->performer ) ) {
$schema[<span></span>'performer'] = array(
'@type' => 'Person', // Or 'Organization'.
'name' => $gd_post->performer,
);
}
return $schema;
}
Set your own currency code, and use Organization instead of Person if your performers are groups or companies. Clear any page cache before you test the listing again in Google’s Rich Results Test.