All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.

Author Topic: Most viewed articles from XX Days ago (widget)  (Read 8429 times)

0 Members and 1 Guest are viewing this topic.

Offline 90210

  • Newbie
  • *
  • Posts: 6
    • View Profile
Most viewed articles from XX Days ago (widget)
« on: 14 August 2008, 20:56 »
well.. as i continue to develop my blog.. I keep running into small problems.

I need to display only the top viewed articles from XX number of days ago.

<div>
<h3>Most Viewed Articles</h3>
<?php if (function_exists('get_most_viewed')): ?>
   <ul>
   <?php get_most_viewed('post', 8, 28, 30days); ?>
   </ul>
<?php endif; ?>
</div>


I found this similar article http://forums.lesterchan.net/index.php/topic,355.msg9906.html#msg9906
however.. i am using the second variable as a "character length". not as a "day limit"?
im confused..

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: Most viewed articles from XX Days ago (widget)
« Reply #1 on: 15 August 2008, 03:49 »
If you do a search that is not possible to do a xx number of days ago of most viewed as it does not log data.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline 90210

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Most viewed articles from XX Days ago (widget)
« Reply #2 on: 15 August 2008, 14:35 »
yes i noticed..
however, this seems to be requested by bloggers.
Will this feature ever become available?
when will it be available?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,692
    • View Profile
  • WordPress Version: WordPress 3.0.x
  • Theme Name: lesterchan.net v3.4
Re: Most viewed articles from XX Days ago (widget)
« Reply #3 on: 15 August 2008, 15:08 »
I don't think I will add that in as logging involves too much data to be collected and queries to be generated. I want to keep it as simple as possible.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline Dukessa

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Most viewed articles from XX Days ago (widget)
« Reply #4 on: 29 July 2010, 15:45 »
Hello!

Im not sure this is what 90210 meant... but what Id need is the most commented posts, but only if published in the last xx days.

For instance, I need to display a list of 3 most commented posts, but only if they were published in the past 30 days.
The reason is that it happens that a few posts are VERY commented, above normal, and they are stuck in the list for months and months, but I would like to show also other recent posts that got comments (less but still important).

This doesnt require a log as the wp publish date can be used to filter out all the other posts.

Is there a way to do this?

Thank you

Offline Amine27

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: DeepBlue
Re: Most viewed articles from XX Days ago (widget)
« Reply #5 on: 31 July 2010, 14:51 »
Hi,

Here is a quick patch to view posts from today to last year:

 224c224,226
<       $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER  BY views DESC LIMIT $limit");
---
>       $start_date = mktime(0,0,0,date("m"),date("d"),date("Y")-1);
>       $date_limit = "post_date BETWEEN '".date("Y-m-d", $start_date)."' AND '".current_time('mysql')."'";      
>       $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE $date_limit AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER  BY views DESC LIMIT $limit");

The fun is hard coded in wp-postviews.php (in get_most_viewed()), you can change it to last 7 days like this:

$start_date = mktime(0,0,0,date("m"),date("d")-7,date("Y"));

Best regards.

Offline Dukessa

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Most viewed articles from XX Days ago (widget)
« Reply #6 on: 31 July 2010, 15:16 »
Thank you :)
Even though I think it should be added as a custom parameter inside the function itself.
I ended up coding it manually without the use of the plugin.

Offline azmiii

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 3.1.x
  • Theme Name: snrgv1
Re: Most viewed articles from XX Days ago (widget)
« Reply #7 on: 20 November 2011, 21:12 »
Amine27 you write this last year i need this but your code make error now.

do you or anyone know how to show most popular posts which was puplished two mounts ago or exclude category id=3

please help it is important for me...