[wp-hackers] Is today a new day?! - is_new_day()

Austin Matzko austin at ilfilosofo.com
Wed May 19 14:50:30 UTC 2010

On Wed, May 19, 2010 at 9:29 AM, Baki Goxhaj <banago at gmail.com> wrote:
> Today I came across a wp functions that looks like this *is_new_day()** and
> what it does is: "This Conditional Tag checks if today is a new day." The
> description is at the limits of lazyness I think :) Can anyone tell me how
> does this function help a hacker to make his/her life easier? An example
> would be perfect.

The function the_date(), when called in the Loop, prints the date in
successive posts only when the current day differs from the previous.
The idea is that you might want to print the day only when it's

is_new_day() provides a test for the same idea, but more generally
(not just for the date).

But I would recommend against using is_new_day(), as it makes big
assumptions about global variables and the nature of Loop objects,
assumptions that are less likely to be true as more developers use
custom post types and multiple Loops.

More information about the wp-hackers mailing list