Thread Starter
Ethics
(@ethics)
Hey,
Thank you for the quick reply.
Unfortunately it seems that the code provides a count for the number of posts in the last 24 hours. This causes posts to be shown from the previous day until they have been around for 24 hours.
I’m trying to wrap my head around the formula and how we can make it only count the current days posts.
Here is the code if anybody wants a look at it…
[code]
$today = date("Y-m-d H:i:s"); //Today's date
$daysago = date("Y-m-d H:i:s",strtotime(date('Y-m-j H:i:s')) - (1 * 24 * 60 * 60)); //Today - 1 day
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_date BETWEEN '$daysago' AND '$today'");
if ($numposts >0) {
echo $numposts.' Wallpapers Added';
} else {
echo "0 Wallpapers Added";
}
[/code]
You have a beautiful website btw.
Oh and if you can update the code on the website to have a closing curly brace at the end that would save alot of headaches 🙂
Thanks,
Mario