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

Baki Goxhaj banago at gmail.com
Thu May 20 16:49:53 UTC 2010

> Otto: *Or you could use the_time(). Which is the same as the_date() but
> doesn't have the day logic.*

That's what I have been using and I think the the_date() functionality is
pretty annoying to leave it blank when the date is the same. I don't know
why it has to have that functionality at all.

I could not agree more with Jeremy Clarke thoughts.

Baki Goxhaj
www.wplancer.com | www.banago.info | www.lintuts.com

On 20 May 2010 18:38, Jeremy Clarke <jer at simianuprising.com> wrote:

> On Thu, May 20, 2010 at 11:49 AM, Otto <otto at ottodestruct.com> wrote:
> > Or you could use the_time(). Which is the same as the_date() but
> > doesn't have the day logic.
> If you do that then you need to manually specify the PHP date format
> to be a date rather than the time. This makes no sense, ignores the
> date format setting and completely ignores any filters attached to
> the_date or get_the_date.
> If I want to show a *date* I should not have to use a *time* function
> with an override on the format to show as a *date*. To do so patently
> weird and counter-intuitive.
> the_date() and get_the_date() both use the default date format from
> Settings > General, this is very important as that option has huge
> effects on i18n of themes and on consistency of design. You can
> manually fetch the setting and pass it to the_time(), but that is just
> as weird and also not future-proof.
> > If get_the_date() is ignoring the day logic, then that's a bug. It's
> > supposed to do the same thing as the_date() in this respect.
> I think that get_the_date() should match get_the_time(), which is a
> much more sane function than the_date().
> The real bug is that the_date() includes some very idiosyncratic and
> unexpected behavior without any way to turn it off (see the ticket
> above for a brief discussion of why adding an argument to turn it off
> is awkward).
> What would make sense is if the_date() and get_the_date() did what
> you'd expect based on their names: get and show the date with no other
> restrictions. If people want the weird once-per-day behavior they
> *should* be using a seperate function, like the_date_once()
> (hypothetical), or else use a conditional like:
> if (is_new_day()) the_date();
> I'm willing to concede that modifying date display to actually make
> sense in WP is probably not worth it, as so many people are used to
> the old system and most existing themes already take it for granted
> (though I suspect that most theme authors were surprised when they
> realized how it worked, and wouldn't have minded if the once-per-day
> stuff had never been the default).
> Making get_the_date() show the date without consideration for the
> $previous_day stuff is exactly what should happen, especially because
> it offers a sane workaround for the legacy strangeness of the_date().
> Now when a theme author figures out what's happening and says "WTF
> why?" they can at least look at the source of the_date() and see that
> get_the_date() is there for them so they can harness the standard
> settings (and filters!) for their dates without rewriting the_date()
> entirely, which is what most people must be doing to show dates on all
> posts inside the loop.
> --
> Jeremy Clarke
> Code and Design | globalvoicesonline.org
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list