CCCPaste

Show the modified date even though it's never been modified

/* Show the modified date even though it's never been modified */
function jeg_get_post_date( $format = '', $post = null ) {
	$publish_date  = isset( $post->publish_date ) ? date( $format ?: 'Y-m-d', $post->publish_date ) : get_the_date( $format, $post );
	$modified_date = isset( $post->update_date ) ? date( $format ?: 'Y-m-d', $post->update_date ) : get_the_modified_date( $format, $post );
	$publish_date_number_format  = isset( $post->publish_date ) ? date( 'Y-m-d', $post->publish_date ) : get_the_date( 'Y-m-d', $post );
	$modified_date_number_format = isset( $post->update_date ) ? date( 'Y-m-d', $post->update_date ) : get_the_modified_date( 'Y-m-d', $post );

	if ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'publish' ) {
		return $publish_date;
	} elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'both' ) {
		return $publish_date . ' - ' . jnews_return_translation( 'Updated on', 'jnews', 'updated_on' ) . ' ' . $modified_date;
	} elseif ( get_theme_mod( 'jnews_global_post_date', 'modified' ) === 'modified' ) {
		if ( strtotime( $publish_date_number_format ) >= strtotime( $modified_date_number_format ) ) {
			return $publish_date;
		} else {
			return $modified_date;
		}
	}

	return $publish_date;
}