• Resolved damirkg1

    (@damirkg1)


    Hi there,

    Superb plugin!

    I have just a little question. Is there any filter I can use to format the date of the post in HTML layout to be X hours ago, X days ago, etc. formatting?

    Thanks.

    • This topic was modified 3 years, 5 months ago by damirkg1.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @damirkg1,

    Superb plugin!

    Thanks, I’m glad you like it!

    Is there any filter I can use to format the date of the post in HTML layout to be X hours ago, X days ago, etc. formatting?

    Actually the plugin provides this out of the box ??

    If you’re using the widget, on the Stats Tag settings section under the Display date option there’s -pardon the redundancy- an option called Relative that does exactly this.

    WPP's relative date format option

    If you’re using either the wpp_get_mostpopular() template tag or the [wpp] shortcode then you can use the stats_date_format parameter and set it to ‘relative’, like this for example:

    With wpp_get_mostpopular():

    <?php
    $args = array(
        'stats_date' => 1,
        'stats_date_format' => 'relative'
    );
    
    wpp_get_mostpopular($args);
    ?>

    With the [wpp] shortcode:

    [wpp stats_date=1 stats_date_format='relative']

    • This reply was modified 3 years, 5 months ago by Hector Cabrera. Reason: Fixed code formatting
    • This reply was modified 3 years, 5 months ago by Hector Cabrera.
    Thread Starter damirkg1

    (@damirkg1)

    I’m now even more amazined!

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Date formating’ is closed to new replies.