I looked into this a bit and found out that there is the xxx filter, which you can use to adjust the schema markup.
Here is an example snippet I just put together to add the end date/time to a single-day event. The end time is one hour after the start.
https://gist.github.com/andrasguseo/f9c37187d4b57ad1ebac3e3c7cc5f0e5
Similarly you can add other data to the schema as well. To add “event status” and “event attendance mode” for example you can add a line like this:
$show_markup['eventStatus'] = 'https://schema.org/EventCancelled'
$show_markup['eventAttendanceMode'] = 'https://schema.org/OnlineEventAttendanceMode'
Hope this helps. Let me know if you have any further questions.
Cheers,
Andras
-
This reply was modified 11 months ago by
.
Thank you. I do shows of different lengths but this may help the OP. I was able to automate a bit more than I previously posted by using the venue phone field to hold the end time, leaving the Notes field for just offers and images.
Sorry, meant “ticket phone” field, not venue
That is a nice workaround for this.
Since there was no movement here for more than a week and several solutions were provided I’m going to close this thread as resolved.
If you need anything else, please open a new ticket and we’ll be happy to help out.
Cheers,
Andras
That is a nice workaround for this.
Since there was no movement here for more than a week and several solutions were provided I’m going to close this thread as resolved.
If you need anything else, please open a new ticket and we’ll be happy to help out.
Cheers,
Andras
That’s great, thank you all for your help.
I spoke too soon 🙁
https://www.normawinstone.com/events/
I added that code to my functions.php using the ‘Code Snippets’ plug-in, however because this web site uses the OXYGEN page builder I am not sure if the plug-in will work because Oxygen Builder effectively disables any themes…
…where can I go for any debugging information?
-
This reply was modified 10 months, 3 weeks ago by
plittlefield.
I have found this in my web server logs…
2021/05/04 11:38:31 [error] 29959#29959: *62748 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function wc_string_to_datetime() in /var/www/www.normawinstone.com/html/wp-content/plugins/code-snippets/php/snippet-ops.php(469) : ev
al()'d code:16
Stack trace:
#0 /var/www/www.normawinstone.com/html/wp-includes/class-wp-hook.php(292): gigpress_add_enddate_to_schema()
#1 /var/www/www.normawinstone.com/html/wp-includes/plugin.php(212): WP_Hook->apply_filters()
#2 /var/www/www.normawinstone.com/html/wp-content/plugins/gigpress/output/gigpress_shows.php(567): apply_filters()
#3 /var/www/www.normawinstone.com/html/wp-content/plugins/gigpress/output/gigpress_shows.php(300): gigpress_json_ld()
#4 /var/www/www.normawinstone.com/html/wp-includes/shortcodes.php(343): gigpress_shows()
#5 [internal function]: do_shortcode_tag()
#6 /var/www/www.normawinstone.com/html/wp-includes/shortcodes.php(218): preg_replace_callback()
#7 /var/www/www.normawinstone.com/html/wp-includes/class-wp-hook.php(292): do_shortcode()
#8 /var/www/www.normawinstone.com" while reading response header from upstream, client: 212.159.20.63, server: www.normawinstone.com, request: "GET /events/ HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "www.normawinstone.com", referrer: "https://
www.normawinstone.com/news/"
Hi @plittlefield
Sorry for getting back here after a big break.
The error message says there is no wc_string_to_datetime()
which is used in that snippet.
My mistake, that is a function that comes with WooCommerce.
I’ll take a look and see if I can fix it.
A.
Hi @plittlefield
It took some time and some tinkering… I updated the snippet in the gist and it should work now without WooCommerce as well.
Please give it a try and let me know.
A.
Yay… it works – good job!
https://www.normawinstone.com/events
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "Event",
"name": "Norma Winstone",
"startDate": "2021-08-15T20:00:00",
"description": "with: Marilyn Mazure's Special 4\r\nMarilyn Mazur: (percussion), Makiko Hyrabyashi (piano), Jacob Buchanan (trumpet) and Klavs Hovman (bass)",
"performers": {
"@type": "Organization",
"name": "Norma Winstone"
},
"location": {
"@type": "Place",
"name": "Poznan Festival",
"address": {
"@type": "PostalAddress",
"addressLocality": "Poznan",
"addressCountry": "Poland"
}
},
"endDate": "2021-08-15T21:00:00+01:00"
},
Many thanks,
🙂
Paully
Awesome, happy to hear.
I’m going to mark this as resolved. If you need anything else please open a new thread.
Cheers,
Andras