This feature can now be enabled without writing any code, using an admin UI, with the Timeline Express – Toolbox Add-On.

Out of the box, Timeline Express will display the announcement dates based on your sites settings. That means whether you are using a US or an EU date format, the date will localize itself appropriately.

Inside of Settings > General you can set the date format of your announcements. If for one reason or another you need the announcement dates to display in a different format than what you have set on your settings page, you can use on of our built in filter, `timeline-express-custom-date-format`, to change the date format.

Passing the date through the filter `timeline-express-custom-date-format`, will alter the date format in the admin table listing, the timeline itself and on the single announcement template page.

/**
 * The following function will alter the default date formats
 * and display them in the format 'Apr 22, 2016'
 */
function custom_te_date_format( $date_format ) {
   $date_format = "M d, Y"; // will print the date as Apr 22, 2016
   return $date_format;
}
add_filter( 'timeline_express_custom_date_format' , 'custom_te_date_format' );

Note: If you need additional help with the formatting of dates in PHP, you may want to take a look at the PHP documentation for date.

11 Comments

  1. Where do you submit this? I am using visual composer and i plugged in the tag under the “classic” mode however im not sure where to add this filter. please let me know asap! thanks

    Reply
    • Hi Joe,

      You’ll want to add the code to your plugins functions.php file. If you are unsure of how to, or uncomfortable editing theme files you can use a third party plugin such as My Custom Functions.

      Thanks,
      Evan

      Reply
    • Hi Joe,

      You want to place this into your themes functions.php file, or into a custom plugin or MU plugin that you create. That way, any future updates to the plugin do not wipe out this customization.

      Reply
  2. I am creating a timeline where several posts are occuring on the same date, however I cannot get them to appear in the chronological order since I have no time index om the announcements. Can you help me please?

    Reply
  3. I formatted to just show the year on my front end. That also affects what appears in the dashboard and now only shows the year in the picker field. With this modification, each time I update, on update, it resets to the current date/year – thus taking everything out of order. I have to then update it again with the date/year I want it to show. What do I need to do to maintain my settings with each update?

    Reply
  4. Hi,
    I am using this for a history over 40 years. I want the date to just show the year and not the month and day. How is this possible?

    Reply
  5. Is there any way to not display the date? All I want is to have the month and year.

    Reply
    • On the settings page, you can disable the date. From the dashboard, if you go to ‘Timeline Express > Settings’ you can disable the option for ‘Date Visibility’.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.