Skip to content
Skip to content

Modifying Date & Time Format

Default WordPress Settings

By default, most Themify themes use the Date and Time settings in your WordPress > Settings. To change the date and time format used in the theme, you would go to WP Admin > Settings and select or enter your preferred format. Some themes such as Corporate, Music, ThemeMin, Pinshop, etc. have special post date styling  (the circle post date design), so these themes do not use the Date and Time from your WP Settings because they require special HTML markups to output the custom design. To modify the post date in those themes, you can either create a child theme and modify the loop.php template (where the post date function is located) or add a custom function as provided below.

WordPress date and time settings

Modify Post Date Format With Custom Functions

Note: in most themes, the post and comment date/time format is pulled from your WP Settings (read above). The tutorial below is for the themes that have special post date design such as Corporate, Music, ThemeMin, Pinshop, etc.

To modify the format of the date outputted in a post with a custom PHP function, we can use the themify_loop_date filter:

1. create a file named custom-functions.php in the theme root folder
2. open it and paste the following:


<?php
function custom_themify_loop_date($date_fmt) {
return 'l, F j, Y';
};
add_filter('themify_loop_date', 'custom_themify_loop_date');
?>

3. save it (if you were editing it locally, upload it to your site by FTP) and check your site.

The code sample above will create a date like this:

Tuesday, April 16, 2013

Here's another example for a shorter date


<?php
function custom_themify_loop_date($date_fmt) {
return 'm/d/y';
};
add_filter('themify_loop_date', 'custom_themify_loop_date');
?>

This will create a date like

04/16/13

Note that some themes like iTheme2 separate the date elements and arrange it differently in the design, as is the case with iTheme2, where the date is used to create a calendar icon next to the post name. In themes like these, this filter is not available and you'll have to modify the file containing the date, creating later a child theme to preserve your changes.

You can find more about formatting date on the WordPress Codex.

Black Friday: Enjoy 40% off with code BF2024 or $75 dollar off Lifetime Club: BF24LIFE