Support » Plugin: Post Views Count (Support caching plugins!) » shortcode to show yesterday's stats

  • Resolved klwk


    sorry because I am not good at php.

    I tested adding { date=”‘ . date( ‘Ym’, mktime( 0, 0, 0, date(“n”)-1, date(“j”), date(“Y”) ) . ‘” } this in shortcode in order to show yesterday’s stats but seems not successful, whole code like this:

    [most_view time=”day” date=”‘ . date( ‘Ym’, mktime( 0, 0, 0, date(“n”), date(“j”)-1, date(“Y”) ) . ‘” number=”3″ show=”0″ before=”Top 3!”]

    Is there is simple way to do this? Thank you for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Julio Potier


    This code id a PHP code, if you’re trying to use this in a post content, you’re doing it wrong.
    I think i’ll add this soon:
    [most_view time=”day” date=”-1″ number=”3″ show=”0″ before=”Top 3!”]
    [most_view time=”day” date=”-5″ number=”3″ show=”0″ before=”Top 3!”]
    for example.
    I’ll try to code this asap 🙂

    Btw, the PHP code for your need is:
    echo do_shortcode( '[post_view time="month" date="' . date( 'Ym', mktime( 0, 0, 0, date("n"), date("j")-1, date("Y") ) . '"]' ); // This will always display the count views of the month of last day.



    yes, thanks for your explanation,

    my purpose is to make a page to show yesterday’s stat so that it is like a music album chart. If you can code it for shortcode use, it will be great.

    Plugin Author Julio Potier


    You can create a page template and below “the_content()” you add my last code 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘shortcode to show yesterday's stats’ is closed to new replies.