Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Greg Ross

    (@gregross)

    It seems to work for me, can you try running the following two SQL calls and see what they return (you may need to change the table name if you’ve changed your WP prefix):

    SELECT post_date FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY ID DESC LIMIT 1

    and

    SELECT post_date FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY ID DESC

    The first one should return a single entry, the second will return a long list of all your posts, sorted by newest to oldest.

    Thread Starter PC1271

    (@pc1271)

    Hi Greg,
    Thanks for replying so quickly.
    The select statements seem te be working fine.
    The first one gave the date of the last post, which is “2015-12-05 13:47:31” and the second statement returned the list of dates of all posts with the newest date on top, just as you expected.

    I then activated the last post item in the widget again, and this time, it shows the expected result. I can’t understand why it appears to be working now, but I’m not complaining. ??
    So, it seems to have been a false alarm. So sorry about this.

    Plugin Contributor Greg Ross

    (@gregross)

    No problem, perhaps a corrupt index or something in MySQL.

    Plugin Contributor Greg Ross

    (@gregross)

    Have you run the above SQL commands?

    Thread Starter PC1271

    (@pc1271)

    Hi Greg,
    I’m not sure if this issue is still open, but I noticed that the sql-statements you use to determine the last post, are not completely accurate in case you ‘post-date’ a new post.

    I created and published a few posts in 2016 and the last post date was shown correctly. After that, I created a new post and set the published date to 30 december of last year. Now the last post date shows 30 december 2015 instead of 2 januari 2016.
    It’s because the sql statement is sorting the post by ID and not by post_date.

    So, I would suggest, you would sort by post_date to make the last post date more accurate.
    The website is still new and we are adding lots of archived post; so the last post date would rather often show the wrong date if the sql statement keeps sorting posts by ID.

    Oh, BTW, Happy New Year!

    Plugin Contributor Greg Ross

    (@gregross)

    Happy new year to you as well!

    That’s a good catch, thanks. I’ll add the fix to the next release.

    Thread Starter PC1271

    (@pc1271)

    cool! Thx ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Statistic widget gives date of FIRST and not LAST post’ is closed to new replies.