Support » Plugin: Schema App Structured Data » Published Time

  • Resolved Amir

    (@repenter)


    Hi ๐Ÿ™‚

    I have an issue with published time. I want to be sure that the issue is related to your plugin or not.

    Because My site is in Persian, so my readers are in Iran and we use different calendar called Shamsi.

    So Iranian users install a plugin named “wp parsidate” to convert every Gregorian date to Shamsi. (So dates convert to shamsi which shown to readers)

    Ok, so now if you see the source of this link, you can see these parameters:

    https://www.ajibtarin.com/one-pic/31091

    Yoast Plugin:
    <meta property=”article:published_time” content=”2017-06-07T17:57:45+04:30″/>

    Schema App Plugin:
    “datePublished”:”1396-03-17″
    “dateModified”:”2017-06-07″

    Rating Stars Plugin:
    “datePublished”: “2017-06-07T17:57:45+00:00”
    “dateModified”: “2017-06-07T17:57:45+00:00”

    Ok so the problem is, schema app detects Shamsi date for published date and that gives me an error in structured tools.

    How is that possible, rating stars plugin detects Gregorian for published date but you detect Shamsi one? Is this something that should be fixed on your side?

    Thanks for your time and support ๐Ÿ™‚

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author vberkel

    (@vberkel)

    Hi Amir,

    I just want to acknowledge that we’re checking it this week.

    Regards,
    Mark

    Hi ๐Ÿ™‚

    Did you find any time to check it? ๐Ÿ™‚

    Plugin Author vberkel

    (@vberkel)

    Yes we installed this plugin https://wordpress.org/plugins/wp-parsidate/ on local and one of my other staging site and the schema markup datesโ€‹ are displaying in correct format. The function used in our plugin get_the_date is the correct function to output Post published date so there is no issue there.

    The user either has another date plugin installed or some other plugin is filtering the date.

    Thanks. I did 4 tests and I am sure right now the problem is related to your plugin.

    Test one: Disable all plugins
    In this case dates are ok in google (Because in posts dates are also Gregorian)

    Test Two: Only enabled your plugin
    Same as above

    Test Tree: Enabled your plugin and parsidate
    In posts date are shamsi. In this case your plugin detect shamsi date for published time instead of Gregorian date (your plugin correctly shows Gregorian date for modified time)

    Test four: Enabled everything except your plugin
    In posts, dates are correctly in Shamsi format and in google they are Gregorian and everything is ok

    From these 4 tests I concluded that the problem is your plugin which can not fetch the correct gregorian format for published date

    About the test you had done, maybe you didn’t enable this option to change the dates?
    http://i.imgur.com/4wIcJaw.png

    Plugin Author vberkel

    (@vberkel)

    HI Amir,

    Let me explain why it’s happening to our plugin:

    https://plugins.trac.wordpress.org/browser/wp-parsidate/trunk/includes/fixeโ€ฆ line 19 is the hook and line 120 is the callback function.

    In the code the wpp_fix_i18n function is specifically excluding the callback calls to WPSEO, WC and get_the_modified_date. We use get_the_modified_date for the dateModified but for datePublished the WP Function is get_the_date() which is not excluded. As far as I can tell, the parsidate plugin should be updated to include that function or modified to include Schema App Plugin.

    Thank you.
    Mark

    Plugin Author vberkel

    (@vberkel)

    HI Amir,

    Let me explain why it’s happening, here is the relevant code in wp-parsidate:

    https://plugins.trac.wordpress.org/browser/wp-parsidate/trunk/includes/fixeโ€ฆ line 19 is the hook and line 120 is the callback function.

    In the code the wpp_fix_i18n function is specifically excluding the callback calls to WPSEO, WC and get_the_modified_date. We use get_the_modified_date for the dateModified but for datePublished the WP Function is get_the_date() which is not excluded. As far as I can tell, the parsidate plugin should be updated to include that function or modified to include Schema App Plugin.

    Thank you.
    Mark

    Hi again @vberkel. Sorry for a huge delay in my response. I wanted to thank you when I fix this problem and report you the result, but unfortunately I couldn’t solve it.

    Do you have any idea what should I add to the fixes-date.php file to fix this problem?

    I really appreciate your time ๐Ÿ™‚

    Hi @vberkel ๐Ÿ™‚
    You remember about this issue? Finally my developer could fix this by changing your code:
    http://i.imgur.com/ZhIYM3P.png

    Now datepublished is in Gregorian format. Is this something that you can fix on your side? Because I need to implement it in each plugin update.

    Plugin Author vberkel

    (@vberkel)

    Hi Amir,

    I think the correct way to do this is to add the following on line 134:

    if ( isset( $callers[6]['function'] ) && $callers[6]['function'] == 'get_the_date' ) {
         return $format_string;
    }

    https://plugins.trac.wordpress.org/browser/wp-parsidate/trunk/includes/fixes-dates.php

    I think the best way is to make that one change in WP-Parsidate. Otherwise, you will need to change the code of every plugin (not just Schema App) and theme that uses the built-in WordPress function. What do you think?

    Regards,
    Mark

    Amir

    (@repenter)

    Hey thank you so much Mark for your help ๐Ÿ™‚

    Unfortunately the code you provided didn’t work.

    “you will need to change the code of every plugin”
    For now I only edited your plugin and did the trick for me ๐Ÿ™‚
    http://i.imgur.com/ZhIYM3P.png

    Hi ๐Ÿ™‚
    An update for this thread. My developer fixed this problem by editing this file:
    schema-app-structured-data-for-schemaorg/lib/HunchSchema/page

    https://i.imgur.com/Sn7mMvT.png

    Is it possible for you to add this to your plugin?

    Thanks

    Plugin Author vberkel

    (@vberkel)

    Ok, I’ve included this code change in today’s release. Thank you for the suggestion.

    Amir

    (@repenter)

    Perfect man, thank you so much <3

    Selva

    (@selvamsubramanyam)

    Hi,
    Date of published showing wrong date.
    datePublished
    1970-01-01.

    In page.php I have modified

    ‘datePublished’ => date(‘Y-m-d’, strtotime( $post-post_date ) )

    to

    ‘datePublished’ => date(‘Y-m-d’, strtotime( $post->post_date ) )

    Amir

    (@repenter)

    Yeah @vberkel, actually this was the original code that my developer used.
    ( $post->post_date ) )

    Thanks

Viewing 15 replies - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.