Skip to content

Instantly share code, notes, and snippets.

@rveitch
Created March 11, 2020 22:00
Show Gist options
  • Save rveitch/0857b2b7e4ca2624dbb0bb0e093d7d4e to your computer and use it in GitHub Desktop.
Save rveitch/0857b2b7e4ca2624dbb0bb0e093d7d4e to your computer and use it in GitHub Desktop.
PHP Warning: gmdate() expects parameter 2 to be integer, string given in /wp-admin/includes/dashboard.php on line 934
<?php
function et_last_modified_date_blog( $the_date, $format ) {
if ( 'post' === get_post_type() && 'U' !== $format ) { // Make sure the Unix timestamp is not being requested.
$the_time = get_post_time( 'His' );
$the_modified = get_post_modified_time( 'His' );
$last_modified = sprintf( __( 'Last updated %s', 'Divi' ), esc_html( get_post_modified_time( 'M j, Y' ) ) );
$published = sprintf( __( 'Published on %s', 'Divi' ), esc_html( get_post_time( 'M j, Y' ) ) );
$the_date = $the_modified !== $the_time ? $last_modified . ' | ' . $published : $published;
}
return $the_date; // A filter must always return a value.
}
add_filter( 'get_the_date', 'et_last_modified_date_blog', 10, 2 );
add_filter( 'get_the_time', 'et_last_modified_date_blog', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment