WordPress.org

Ready to get started?Download WordPress

Forums

Post Views Count
[resolved] shortcode to show yesterday's stats (4 posts)

  1. klwk
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/baw-post-views-count/

  2. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. klwk
    Member
    Posted 1 year ago #

    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.

  4. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    You can create a page template and below "the_content()" you add my last code ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.