One of our users asked how they can display future dates differently than the rest of the dates on the site. They wanted to have future dates show up as ‘Future’. Using the following snippet, users can display ‘Future’ in place of future dates, while displaying the announcement dates as they would normally appear.

Note: The following snippet will alter the dates on both the timeline itself, on the single announcement templates.

/**
 * Filter future dates to display 'Future' instead of the date
 * @param  integer $announcement_date The announcement date
 * @return string                   	The new announcement date to use.
 */
function replace_future_dates( $announcement_date ) {
	if ( strtotime( $announcement_date ) > current_time( 'timestamp' ) ) {
		return 'Future';
	}
	return $announcement_date;
}
add_filter( 'timeline_express_frontend_date_filter', 'replace_future_dates' );

Leave a Reply

Your email address will not be published.

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