Hello,
Is there a simple way to change the 7 days post views sorting to only 1 day for example?
I have removed unwanted days from initializing array on line 81 in td_post_views.php but that didn’t do the trick.
Could you help me change the number of days to be sorted?
I have tested Jetpack method as well but it’s too much of a resource hog on a high traffic site…
Hi,
Unfortunately I cannot provide a solution for this, almost the entire function should be re-written and this sort order was designed for for 7 days.
I suggest to hire a professional developer to do this for you as this is not an easy task and we are not available for custom services at this time, sorry!
Thanks!
Thank you.
For interval counting only … does it needs to be changed only in td_post_views.php or is related with other files as well?
Are Jetpack stats served form wordpress.com only or they are or can be stored locally? I don’t like to be connected to wordpress.com all the time just to get stats – high traffic site?
I would really appreciate any other solution, maybe other plugins you suggest?
Hi,
You can change the 7 days functionality in td_page_views.php and also the sort order(only if you need this) in td_data_source.php – http://screencast.com/t/XYgdDWJWq
Indeed the Jetpack plugin consumes many resources. What I can recommend you is to leave active only the Jetpack modules that you use and disable all others.
After we received many reports from our users regarding the theme 7 days sort order, the developers took decision to implement this jetpack feature and it should be seen as an improvement. Let me tell you why! Many clients want to use 7 days with a cache plugin for example and the sort order doesn’t work properly with it, so we have added the ajax view counter. It will retrieve from the server the correct post view count, but this means many requests to the server if you have many readers. Using Jetpack stats feature the requests will be made to their server where they are stored.
I guess you could use this feature, but like I said above only with the modules that you need active. Unfortunately I cannot recommend another plugin which is not been tested,sorry!
Hope this helps!
Thank you Alin, it helps.
I’ve temporarily enabled Jetpack sorting, but the prev next arrow pagination ain’t working right.
When I click on the next set of posts, it loads almost identical (same but different order) posts but then this set is shown for both prev and next posts.
Is theme’s 7 day sorting and ajax post views in conflict with Jetpack stats and should be disabled?
.. anyway looks like we’ll reconfigure the 7 days order, because of too many new posts added every day.
One more question about the comments … how hard is it to reconfigure the sort for most commented posts in last 2 days only, and not for all time most commented like it is by default?
Hi,
Regarding Jetpack sort order issue, I have added this on our list for further investigations. I have made a quick test on my side and it seems that it doesn’t work properly. Try to use it without pagination until we will find a solution to work also with block pagination.
You can change the comments sorting option in data source file, as reference you can take a look how the Random 7 day is created and try something similar – http://screencast.com/t/PGbDHqRH4oo
Here you can find more info – http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
Thanks!
Good to hear that Jetpack issue is on your side too, since I thought it’s probably just on my side…
I’ve changed the most commented sort as you’ve described but it didn’t make any change in sorting. There are still All-time Most commented post on top… I’m using Disqus comment system if that has any affect on sorting?
For Most viewed posts, I’ve put this code from 7 day random and change it to sort only post published 3 days ago… and put one custom code to td_page_views.php on line 72, after update_post_meta($postID, self::$post_view_7days_last_day, $current_day);} :
/* Custom counter */
$num_days = 2;
for($i=1;$i<8-$num_days;$i++) {
$day_index = $current_day + $i;
if($day_index > 6) $day_index -= 7;
$count_7_day_array[$day_index] = 0;
}
But doesn’t make any difference … I was told it should work.
Any suggestions?
I’ll post the solution when It will be working…
Otherwise it would be good if the theme would have it’s own post view counter working with cache, since it’s the only flaw, I see this, theme has.
Thank you and best regards,
Hi,
This solution lists most commented articles posted within X date, not looking for most amount of comments within that time span among all articles. If you want a different implementation you will need custom modification and it is not an easy task. You will need to create something like the Recent comments widget, to take all the recent comments and then sort the post by most commented.
Regarding the 7 days code, it needs many tests and unfortunately the time doesn’t allow use to do this, sorry!
Thanks!
Alin, thank you for your support.
To look for most commented articles posted within that range, e.g. 2 day is ok.
I don’t need to count comments and sort it, so I’ve copied query from random 7 day and changed it to 3 day ago, but it doesn’t change the sorting.
I cannot get your sort order right. I’ve tested sorting for 7 days random posts too, which is sorting right. But if I change instead of ‘1 week ago’ to ‘3 days ago’ it’s always showing articles within 7 day range.
The query doesn’t have any effect.
Can you please confirm this?
Anyway, I’m sorry to keep open this thread for so long but I would really like to solve this.
About the custom counter code… I’ve pasted it if someone finds it useful. I was told it should work for most cases, but it’s not working for me. 🙂
Hi,
I have tested this and it works. Please note that using this solution it will display all post published in the last 2 days(or whatever you wish) and the sort order will be after comments counts.
Please check:
– http://screencast.com/t/q8rczvh8
– I have only 2 post published in last 2 days – http://screencast.com/t/A9Dt8xCjTEM
– Block settings – http://screencast.com/t/ihAU8Njxhp – http://screencast.com/t/MhiBcWX0mnpv
– Result – http://screencast.com/t/xbbXgvQv
Hope this helps!
Hello,
Thank you for the details Alin.
I see you have only 2 comments … can you try adding some comments to post published earlier?
Hope it works, cause it still ain’t working for me. It’s like it doesn’t have any effect at all and is showing all time most commented posts.
The solution to show only post published 2 day ago would be great. It should work for popular 7 as well?
I’ve tried but again, it ain’t working. This would solve these 2 issues and this topic 🙂
Hi,
I have told you that this solution is for post published in last 2 days, not for comments added in last 2 days for all posts. It will pull the articles posted in last 2 days then it will sort them by number of comments. You realize that making this for comments added in the last 2 days for all posts it needs to create something similar to the 7 days order. Unfortunately I cannot provide a solution for this as requires to review all the code and the time doesn’t allow us to provide custom work, sorry!
Thanks!
Hi,
It doesn’t matter the number of comments, only the order will be influenced by this
– http://screencast.com/t/s2n2C28mXs
– http://screencast.com/t/3lJokFFYa
– http://screencast.com/t/zmP0upu2bUw
– http://screencast.com/t/zeVsYzZzycG
Thanks!
Alin, once again thank you.
I see it’s working for you, not for me.
This is the my code for most commented sort… if you see something wrong:
case ‘comment_count’:
$wp_query_args[‘orderby’] = ‘comment_count’;
$wp_query_args[‘order’] = ‘DESC’;
$wp_query_args[‘date_query’] = array(
‘column’ => ‘post_date_gmt’,
‘after’ => ‘2 days ago’,
);
break;
I’m using Disqus – maybe that’s why the sort ain’t working? I don’t have Jetpack installed, but this sort isn’t related to Jetpack I guess…
Hi,
It is not related to Jetpack, but I did not tried using disqus plugin, I guess it should work also. You can try using the theme by default without any plugins active except of Visual Composer and add this code(maybe the quotes your are using create issues) – http://pastebin.com/KzW9Cgpp
Thanks!
Hello,
Sorry, I still can’t get it to work, have tried the quotes before too..
Haven’t tried disabling plugins yet. Is there any other way to debug this issue?
I see the new theme update (6.6) updates td_data_source.php … anything related to sort?
Should this kind of query, for post published e.g. 2 days ago worked for Popular 7 day sorting as well?
Thank you.
-
This reply was modified 10 years by
diom.
Hello,
Please disable all your plugins except visual composer. It worked for us on the default theme so it should work for you as well if you made the same modification and did not miss anything.
If it’s still not working, please follow the method again to see what you may have missed.
Thank you!
Hi,
We have not tested this so we cannot say for sure if it will work. This customization will not be a walk in the park as it’s not enough to simply add a few more days and the counter will work with it. The function was created on the 7 days baseline, so chances are, the whole function will have to be changed. For this, you will require php knowledge. If you cannot do it we recommend hiring a freelancer to help out as we cannot offer any custom work at the moment.
Thank you!
Hello,
The 7 days post sorting has a fixed number of days. There is no way of selecting the amount of days for this sorting option. Alternatively you can use the jetpack sorting option that provides 2 days sorting: http://screencast.com/t/QKgw0F6wF
We already added this suggestion to our list for future updates but it’s up to the development team to decide if this will get implemented.
Thank you!
Hi Bogdan,
Thank you. Choosing jetpack didn’t show anything for me. I selected “-Latest-” and that showed me the latest news, which I think works for me as the site is updated frequently with at least 20 articles per day.
Is “Latest” a function or just a “select/heading” option? 🙂
Thank you
John
Hi,
If you want to use the jetpack sorting option, you need to have jetpack installed and the stats module active.
You also need post views on and ajax view count if you use a cache plugin.
The latest articles is a post sorting option that is defined globally to pull your latest posts.
Thank you!