Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi there!

    Please, post your code here (or upload it to pastebin.com if it’s too large) so I can chdck it out.

    By the way, it’s wpp_get_mostpopular() and not wpp_get_most_popular().

    Thread Starter mctenold

    (@mctenold)

    By the way, it’s wpp_get_mostpopular() and not wpp_get_most_popular().

    Then the text is wrong here: https://i.imgur.com/2Uq3A3V.png

    Please, post your code here (or upload it to pastebin.com if it’s too large) so I can chdck it out.

    <?php wpp_get_mostpopular('freshness=1&range=monthly&limit=3&stats_date_format="c"&stats_views=0&stats_date=1&thumbnail_width=300&thumbnail_height=440&wpp_start="<div class=\'pop-posts\'>"&wpp_end="</div>"&post_html="<a><div class=\'darken\'>{thumb_img}</div><h2 class=\'timeago\' title=\'{date}\'></h2><h1>{text_title}</h1></a>"'); ?>

    Thread Starter mctenold

    (@mctenold)

    In order to get it working quickly, I had to edit the source. :/ I changed line 2211 in _get_date() to:

    $date = date_i18n('c', strtotime($p->date));

    I’m using the jQuery timeago plugin, and it needs it in an ISO 8601 timestamp.

    Even changing the format to something like “Y-m-d” wasn’t working for me, the format was stuck at something like “August 26, 2015”.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Indeed, however in the documentation below it should be correct. I’ll fix that on the next release.

    Code looks good to me, but can’t test it at the moment since I’m away from the computer now.

    Out of curiosity, why is your H2 tag empty?

    Thread Starter mctenold

    (@mctenold)

    Out of curiosity, why is your H2 tag empty?

    It gets filled by the jQuery timeago function.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, gimme a sec to check what’s going on.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Tested your code on localhost and it works for me (see screenshot). What output do you get over there?

    Thread Starter mctenold

    (@mctenold)

    I’m not seeing anything at that screenshot link.

    Plugin Author Hector Cabrera

    (@hcabrera)

    The highlighted line is where the date is being output. See the “timeago” class in there?

    Thread Starter mctenold

    (@mctenold)

    Oh, the screenshot link wasn’t showing a screenshot before, I see it now.

    Weird. Not sure why it wasn’t working on my end. I was trying all kinds of date formats in stats_date_format and nothing was changing the date format outputted. The only thing that worked was changing it in the source.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Format date in post_html’ is closed to new replies.