Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
diom
tagDiv Member

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.
diom
tagDiv Member

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…

diom
tagDiv Member

I know, this solution is what I need …

Can you add some comment for the post published earlier than 2 days ago and check if it’s showing only posts published 2 days ago? I assume the block will show all 3 posts with comments like mine…

diom
tagDiv Member

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 🙂

diom
tagDiv Member

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. 🙂

diom
tagDiv Member

Here is JS code for date and time which works with cache plugins.
Inserted in date div in top-menu.php.

<script>
function addzero(i) {if (i < 10) { i = “0” + i; } return i; }
function fDate() {
var d = new Date(); var ddd = [“Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”]; var dd = ddd[d.getDay()]; var months = [“January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,”September”,”October”,”November”,”December”]; var mm = months[d.getMonth()];
document.getElementById(“date”).innerHTML = dd+”, “+d.getDate()+”. “+mm+”, “+d.getFullYear()+” – “+addzero(d.getHours())+”:”+addzero(d.getMinutes())+”:”+addzero(d.getSeconds());
}
setInterval(function fDateI() {
var d = new Date(); var ddd = [“Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”]; var dd = ddd[d.getDay()]; var months = [“January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,”September”,”October”,”November”,”December”]; var mm = months[d.getMonth()];
document.getElementById(“date”).innerHTML = dd+”, “+d.getDate()+”. “+mm+”, “+d.getFullYear()+” – “+addzero(d.getHours())+”:”+addzero(d.getMinutes())+”:”+addzero(d.getSeconds()); }, 1000);
fDate();
</script>

Date format is localized and it’s showing seconds.

cheers,

  • This reply was modified 10 years by diom.
diom
tagDiv Member

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,

diom
tagDiv Member

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?

diom
tagDiv Member

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?

diom
tagDiv Member

Thank you Alin,

Your demo has the same problem which I guess everyone else who is using this theme have. The top bar isn’t showing the right date when caching is enabled (no matter the plugin).

One way is to get the date with javascript. I’ll post a solution when I find one.

But would be glad if you provide one before I do 🙂

Viewing 10 posts - 1 through 10 (of 10 total)