Skip to content

Snippet: Alter Recent News Day & Month/Year Display

Note: In newer versions of the Total theme you can enter your custom date format by editing the element itself via the page builder.

// Alter the day output.
add_filter( 'vcex_recent_news_day_output', function() {
    return get_the_time( 'j', get_the_ID() );
} );

// Alter the month & year output
add_filter( 'vcex_recent_news_month_year_output', function() {
	$month_year = '<span>'. get_the_time( 'M', get_the_ID() ) .'</span>';
	$month_year .= ' <span class="year">'. get_the_time( 'y', get_the_ID() ) .'</span>';
	return $month_year;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top