Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Lester Chan

    (@gamerz)

    Sorry, I am afraid that is not possible. We just store the accumulated views and hence it is not popular to do any time related sorting of popular posts

    What about creating a second sql table where post views are increased and stored only if $present_data-$creation_of_sql_table_data < 604800 (aka 7 days)? If $present_data-$creation_of_sql_table_data > 604800, then the table is deleted and created again.
    I don’t know if it’s possible or if there’s a more efficient way, but I suppose that such feature (already offered by Jetpack) would be much appreciated by a lot of users.
    After many years, I feel that it would be more useful to display the most viewed post in the, let’s say, last month, rather than the most viewed post in the last 6/7 years.
    Thanks

    i use from this code:

    <ul>
    <?php
    query_posts( array( 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC','showposts' => '6', 'w' => '. date( "W", current_time( "timestamp" ) )' ) );
    while(have_posts()) : the_post();?>
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile;wp_reset_query();
    ?>
    </ul>

    'w' => '. date( "W", current_time( "timestamp" ) )' )

    That sounds like a great solution to me.
    Maybe the developer want to take a look at it and include a widget in the next release.
    Thanks.

    It looks like the code is giving the exact results of the generic “Most Viewed” widget, thus displaying the top posts of all time and not of the week.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to display popular posts in week?’ is closed to new replies.