I’d like to add a date based condition to the code I have to reset the counter on every Sunday 00:00:00 but I can’t figure out how to do it.
This is what I have, but it doesn’t reset the counter to 0.
[php]//COUNT PAGEVIEWS
function wpb_set_post_views($postID) {
$count_key = ‘wpb_post_views_count’;
$count = get_post_meta($postID, $count_key, true);
$today = date(‘l H:i:s’);
if($count==’’ || $today == ‘Sunday 00:00:00’) {
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, ‘0’);
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}[/php]
Has anyone a clue
Thanks