| User | Post |
|---|
4:26 pm October 13, 2009 | Greg Wilcox
| | | | | Member | posts 15 |
| | Ok so here is a suggestion our opinions editor gave. To the right on our website is that widget that tells you which articles are the most popular, latests, comments, tags, etc. The concern he brought to me was that some articles that were way popular weeks ago still stay on that list. This then entices people to keep looking at it, keeping it on the list and preventing newer articles from making it on there. Thus, the concern is that newer articles aren't becoming as popular because the older ones steal the space on the popular feed. After discussing it, we thought that maybe it would be best to have the popular feed update and start anew every couple weeks or so so that newer articles can get some screen time on there. What do you guys think? How could this be done? |
|
1:40 pm October 14, 2009 | Chris Ullyott
| | Fullerton, CA | | | Member | posts 66 |
| | Greg, we just implemented this change on our site. The default script actually pulls the most popular stories from the last year. Lame! Here's how you do it: 1. In your theme folder, open the "includes" folder and edit "popular.php" 2. The second PHP value down, $lastmonth, calls a Unix timestamp and subtracts time to give you the cut-off period. We found that our code said "date("m")-12″, which would go back 12 months. 3. Delete this "-12″ and move over to the "d" for days. We have "date("d")-10″, to set the cut-off period at 10 days. | |
|
6:50 pm October 14, 2009 | Greg Wilcox
| | | | | Member | posts 15 |
| | Great! Thanks so much.  |
|
12:39 am October 26, 2009 | Greg Wilcox
| | | | | Member | posts 15 |
| | Actually, now the popular section is just empty. I think I had done it wrong, so I made a change… maybe it's easier if I just post the coding I have right now: $lastmonth = gmdate("Y-m-d H:i:s",gmmktime(date("H"), date("i"), date("s"), date("m"), date("d")-10, date("Y"))); Before, it was: $lastmonth = gmdate("Y-m-d H:i:s",gmmktime(date("H"), date("i"), date("s"), date("d")-10, date("d"), date("Y"))); Is it correct as it is now? -Greg |
|
1:17 pm October 26, 2009 | Chris Ullyott
| | Fullerton, CA | | | Member | posts 66 |
| | You need to leave the date("m") variable in there. Otherwise, it isn't a correct timestamp and it doesn't work. The only edit was to take out the "-X" from the month and add it to the day variable. | |
|
7:00 pm November 12, 2009 | Chris Ullyott
| | Fullerton, CA | | | Member | posts 66 |
| | Hey Greg, did everything work out? | |
|