Event schema
This topic contains 19 replies, has 3 voices, and was last updated by Kiran 6 years, 2 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: event, schema.org, snippet
-
AuthorPosts
-
September 28, 2018 at 8:19 am #448096
Hi,
I saw the thread about invalid schema for Event https://wpgeodirectory.com/support/topic/invalid-event-category-schema/I’m getting warnings from my Google console to fix schema markup warnings for missing performer and missing offer as well.
Offer and performer is not part of the Events form. Can I fix it by adding custom fields – can I somehow add schema.org markup for my custom fields?
Can there, for example, be an organization/person field that can be marked up both for organization and performer; seeing as the value for “performer” is expected to be an organization or person? (e.g. who is responsible for holding an event).
Offer can be any of several things so a field to narrow down what an event is about could be marked up for an “offer”: AggregateOffer(price), CreativeWork, Event, MenuItem, Product, Service, Trip).
There was a thread on custom fields but it didn’t quite answer what I am after.
Thanks,
LiseSeptember 28, 2018 at 8:58 am #448102Hi Lise,
Can you attach screenshot/lists which type of warnings it showing in schema?
Via using hook you can add custom fields in schema. See example here: https://wpgeodirectory.com/support/topic/price-range-schema/#post-435471
Kiran
September 28, 2018 at 10:02 pm #448165Hi,
attached screenshot from the structured data testing tool and from Google console.Will check out the other post.
September 29, 2018 at 1:28 am #448181I have added the “price” custom field but when I test an event listing, it does not include schema.org jsonld markup for “offer”.
I have also added text-area to include Event organizer. How can I mark this up for structured data to be the “performer” type organization / person. Will I have to include another field for choosing organisation or person to get the right schema?
September 29, 2018 at 7:52 am #448201This reply has been marked as private.October 1, 2018 at 6:22 am #448307Hello Lise,
– To add offers schema add price field (there is already predefined field with name geodir_price) from custom field settings.
– Create new text field with key(name) ‘geodir_performer’
– Add following code snippet.function _gd_snippet_custom_event_schema( $schema, $post ) { if ( empty( $post ) ) { return $schema; } if ( ! empty( $post->post_type ) && $post->post_type == 'gd_event' ) { // offers if ( isset( $post->geodir_price ) ) { $offers = array(); $offers['@type'] = 'Offer'; $offers['price'] = $post->geodir_price; // Field geodir_price $offers['priceCurrency'] = 'USD'; // Currency code $offers['availability'] = 'http://schema.org/InStock'; $offers['url'] = $schema['url']; $offers['validFrom'] = $schema['startDate']; $offers['validThrough'] = $schema['endDate']; $schema['offers'] = $offers; } // performer if ( isset( $post->geodir_performer ) ) { $performer = array(); $performer['@type'] = 'Person'; $performer['name'] = $post->geodir_performer; // Field geodir_performer $schema['performer'] = $performer; } } return $schema; } add_filter( 'geodir_details_schema', '_gd_snippet_custom_event_schema', 999, 2 );
Thanks,
KiranOctober 2, 2018 at 7:58 am #448429Hi,
I have set the html variable name for the predefined price field to geodir_price and entered a new text field with the html variable geodir_performerI then entered the snippet in the snippet editor and saved and activated.
I edited one of my test listings to include price and performer and went to the Google structured data tester and it still showed error for offer and performer?
I cleared the cache and tried again but no luck.
Attached the screenshot if you can pick anything I missed.
October 2, 2018 at 8:05 am #448433This reply has been marked as private.October 2, 2018 at 10:05 pm #448551Attached screenshot of how the performer field shows up in the developer tools. I can easily find the jsonld schema information for the rest of the Event detail.
October 3, 2018 at 6:49 am #448596This reply has been marked as private.October 3, 2018 at 8:56 am #448610Sorry, I wonder if it might have to do with me being logged in when I copied the url??
The url is a bit different now – from a browser I am not logged in.
I do have a new security software but hope that has nothing to do with it – MalCare Pro
October 3, 2018 at 10:09 am #448623This reply has been marked as private.October 3, 2018 at 10:25 am #448625I have disabled MalCare security, firewall and login protection.
When I follow the link from the forum entry, it opens ok for me? I can also open it on mobile and in Chrome when not logged in.
October 3, 2018 at 1:27 pm #448657This reply has been marked as private.October 4, 2018 at 12:01 am #448714This is all very strange – I found your IP denied in my .htaccess? Not sure how it got there in the first place. I have deleted the deny directive so hope all is good then.
My error log in cPanel showed a string of access requests from your IP.
I have activated MalCare again.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket