Blog post date not in format required by schema.org
-
20-10-2020 - |
سؤال
I'm trying to display blog posts using the BlogPosting schema from Schema.org, but I am having difficulty getting the date to display in the required format.
Currently, the responsive_child_post_meta_data() function contains the following:
<time itemprop="datePublished">%2$s</time>
But when I try to validate the results using the W3 HTML Validator, I get the following error message:
Error: The text content of element time was not in the required format: The literal did not satisfy the time-datetime format. Syntax of time-datetime: One of the following: month, date, yearless date, time, local date and time, time-zone offset, global date and time, week, non-negative integer, or duration. For more information and examples, see the section on the datetime value in the HTML specification.
المحلول
Not sure what responsive_child_post_meta_data()
is but I use this and it validates just fine:
<time itemprop="datePublished" class="published" datetime="<?php echo get_the_time('c'); ?>" content="<?php echo get_the_time('c'); ?>">
<?php echo get_the_date(); ?>
</time>
لا تنتمي إلى wordpress.stackexchange