Event schema

This topic contains 19 replies, has 3 voices, and was last updated by  Kiran 6 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #448096

    lisec73
    Full Member
    Post count: 180

    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,
    Lise

    #448102

    Kiran
    Moderator
    Post count: 7069

    Hi 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

    #448165

    lisec73
    Full Member
    Post count: 180

    Hi,
    attached screenshot from the structured data testing tool and from Google console.

    Will check out the other post.

    #448181

    lisec73
    Full Member
    Post count: 180

    I 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?

    #448201

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #448307

    Kiran
    Moderator
    Post count: 7069

    Hello 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,
    Kiran

    #448429

    lisec73
    Full Member
    Post count: 180

    Hi,
    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_performer

    I 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.

    #448433

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #448551

    lisec73
    Full Member
    Post count: 180

    https://myschooladvisor.com.au/events_open_days/south-australia/adelaide-bc/open_day/australian-catholic-university-acu-open-day-canberra/?gde=2019-08-24#post_info

    Attached 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.

    #448596

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #448610

    lisec73
    Full Member
    Post count: 180

    https://myschooladvisor.com.au/events_open_days/south-australia/adelaide-bc/open_day/australian-catholic-university-acu-open-day-canberra/?gde=2019-08-24

    Sorry, 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

    #448623

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #448625

    lisec73
    Full Member
    Post count: 180

    I 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.

    #448657

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #448714

    lisec73
    Full Member
    Post count: 180

    This 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.

Viewing 15 posts - 1 through 15 (of 20 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount