• I’m developing a new theme, and came across the phenomenon where the the_date template tag does not display the date more than once (mental note: add to Ideas after I post this).

    The alternative listed everywhere is to use the_time, but that requires me to decide on a single date formatting string for all users. With an earlier theme I did, people kept bugging me to change this so they could have the date displayed according to their country’s conventions.

    Is there any way to ‘get to’ the date formatting setting under ‘Settings->General’ and feed the format string to the_time?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Errr… huh?

    If you just use the_time() then it defaults to whatever the date formatting string in Settings->General is. Just like the_date() does.

    Thread Starter weefselkweekje

    (@weefselkweekje)

    As far as I know, it’ll use the formatting string under “Time format” (not “Date format”), and will display the time, not the date.

    The thing is that lots of themes show the date for every post, not as a divider between days. This is how I’d like my theme to work as well. The only way to do this is to use the_time with a hard-coded format string. For international users, this is less than ideal.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Ahhh, yes, I see. You want to use the date format string with the_time. Okay then. Use this:
    the_time(get_option('date_format'));

    Thread Starter weefselkweekje

    (@weefselkweekje)

    Thanks Otto 🙂 Several entire continents will be pleased 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using the_time with user-preferred date formatting?’ is closed to new replies.