Choosing the Date Format in WordPress Themes: Let’s Give Control Back to the User

So many WordPress themes have the date format hard coded into the theme files. The problem is that some users will prefer to display the date in another way. Maybe the chosen format doesn't match their organization's style guidelines or maybe the format isn't grammatically correct. Changing a hard-coded date requires users to dig through file after file to modify every instance. Plus, if the theme developer releases an update, the user may need to do it all over again. To save users the hassle, why not let them decide how the dates are displayed. There is a setting in WordPress after all.

Screenshot of WordPress' date format settingNow, there may be reasons for theme developers to specify the date format, but they're probably not in the best interest of the user. Here are some reasons not to hard code the date:

  • Give Users the Control — themes users have different wants and needs. The more control they have over the theme used on their website to meet those needs, the better. As mentioned previously (You Haven’t Even Started Blogging and You Already Have a Typo), there are quite a few themes that incorrectly list dates using the ordinal format (ex: January 16th, 2012). It would be nice if the user could modify the format without editing the theme files.
  • Increase Ease of Maintenance — WordPress makes it relatively easy to edit theme files. However, it's much easier to change the date format under the admin panel versus replacing all the hard-coded references. Plus, if a user modifies the theme files, they may need to do it all over again whenever new versions of the theme are released.
  • Prevent Inconsistencies — since a theme is made up of several PHP files, there's a greater chance for the date to be coded differently from page to page. One may list the month as three letters while another may spell out the month. Utilizing WordPress' built-in feature to maintain dates is an easy way to remain consistent.
  • Match Their Brand — some organizations have spent a fair amount of time developing a style guide for their content. These guidelines may describe how to format things like dates so that there is consistency throughout the website, marketing materials, etc.

Conclusion

Hopefully this was enough to convince the theme developers out there that relinquishing the control over the date is in the best interest of the user. Let's utilize WordPress' built-in feature and stop making users edit theme files just to change the date format.

If you're not swayed, I would love to hear why hard-coding the date format into the theme is the preferred option. Or maybe there are some additional arguments for letting the user decide the format. Either way, please enter your comments below.

Note: for those wanting to utilize the date format set through the WordPress admin panel, you'll want to come back next week (Using the Date Format Chosen by the User Instead of Hard-Coding Your Own in the WordPress Theme). We'll discuss some of the options available for getting the date and things to watch out for.

0 Comments

There are currently no comments.

Leave a Comment