Skip Navigation

[Résolu] Issue with Toolset Types date fields and Schema Pro Plugin

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to map Toolset date fields to Schema Pro dates, but the Schema Pro date format should be like 2019-01-26. Toolset's format is like 1525478400. I would like to discuss the issue with Schema Pro's developers. What should I tell them?

Solution: Toolset uses a format called Unix timestamps. A developer should be able to convert a Unix timestamp into any formatted date using PHP or another programming language. As a fallback, the Types field shortcode will produce any PHP date format you specify. You could use those shortcodes to generate some readable format for Schema Pro.

Relevant Documentation:
https://en.wikipedia.org/wiki/Unix_time
https://www.unixtimestamp.com/

This support ticket is created Il y a 5 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par peterS-14 Il y a 5 années et 9 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1207744
Schema Pro Event Dates Error.JPG

I am trying to: generate schema.org info's with Schema Pro Plugin for Events listings from date fields made with Toolset Types.

The issue is that when I map the Toolset Types created date fields they show values like 1525478400 instead of a google conform date when checking in the Google Structured Data Testing Tool

I expected to see: a date like 2019-01-26

Now my question is: what should the devs at schema pro look for to convert the Toolset data field value to the proper ISO 8601 value as defined by schema.org

Any hint will be very appreciated ?

#1207978

Hi, Toolset uses Unix timestamps to store dates in the database. It's a fairly common format, and a developer should be able to convert these numbers as needed. For example PHP lets you format a date like this:

$nice_format = date('Y-m-d',  1525478400 );

https://en.wikipedia.org/wiki/Unix_time
https://www.unixtimestamp.com/

Also the Types field shortcode will allow you to apply any PHP date format, so if you're able to use shortcodes to map these fields you could do something like this to output the proper format:

[types field='your-field-slug' style='text' format='Y-m-d' id='123456'][/types]

Replace your-field-slug with your date field slug, and replace 123456 with the numeric ID of the post, or a nested wpv-post-id shortcode.

#1207993

Hi Christian

Thanks a lot for looking into this and providing a precise solution I can forward to the Schema Pro devs and and also the fallback option in case I need to add the dates via type fields shortcode into the corresponding content templates or views.

My issue is resolved now. Thank you!