• Resolved jdavidstark

    (@jdavidstark)


    I have the plugin installed, and it appears to be working correctly (e.g., the “Last updated” entry at the bottom of this post: https://www.jdavidstark.com/citing-electronic-journals-with-individual-articles/).

    But, when the “updated” date is earlier than the “published” date, no “Last updated” entry appears as on the page I’ve listed for help. This situation may frequently recur if a post is scheduled for publication at a later time than its last draft is saved.

    In such a case, would it be possible for the plugin to display the published date (and timestamp) since this is the “last updated” date that any readers would be concerned about?

    Thank you so much for your help!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Sayan Datta

    (@infosatech)

    Hi, add this snippet to your functions.php file:

    function override_time_diff() {
          return '-10'; // 10 seconds
    }

    add_filter( 'wplmi_date_time_diff_post', 'override_time_diff' ); // for posts
    add_filter( 'wplmi_date_time_diff_page', 'override_time_diff' ); // for pages

    Thread Starter jdavidstark

    (@jdavidstark)

    Thanks so much. I’ve added the following to the bottom of functions.php:

    function override_time_diff() {
          return '-10'; //10 seconds
    }
    add_filter( 'wplmi_date_time_diff_post', 'override_time_diff' ); //for posts
    add_filter( 'wplmi_date_time_diff_page', 'override_time_diff' ); //for pages

    But, the “last updated” information still doesn’t show on this post and several others as it does on this one.

    Might you have any other suggestions?

    Plugin Author Sayan Datta

    (@infosatech)

    Hi, as there is a near about 30 days difference between published time and modified time, you need to just change -10 in above snippet.

    Just replace the above snippet with this:

    function override_time_diff() {
      return '-2592000'; //2592000 seconds i.e. 30 days, change it according to your need
    }
    add_filter( 'wplmi_date_time_diff_post', 'override_time_diff' ); //for posts
    add_filter( 'wplmi_date_time_diff_page', 'override_time_diff' ); //for pages

    Hope, this will definitely work.
    Thanks!

    Thread Starter jdavidstark

    (@jdavidstark)

    Ah, I see. Ok. Thank you. That’s fabulous and does seem to be working perfectly.

    One more question, if I may: Doing this sort of thing is quite new for me. Will this change get wiped out and need to be reapplied if I update the installed theme? Or, will this persist through theme upgrades?

    Plugin Author Sayan Datta

    (@infosatech)

    Yes, it need to be reapplied every time if you update your theme. If you are using child theme then you don’t need to worry. It will be safe. If not, you can start using child theme or use free Code Snippets plugin to keep this code forever.

    Thanks! ??

    Thread Starter jdavidstark

    (@jdavidstark)

    Ok. Great. Thanks so much for your help, again, and for that additional recommendation!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Use Published Date If Updated <= Published’ is closed to new replies.