Last active
November 8, 2019 19:58
-
-
Save westonruter/428d2bc4c643873d0f476b03fb52f526 to your computer and use it in GitHub Desktop.
Re: Warning: date() expects parameter 2 to be integer, string given in /www/wp-content/plugins/amp/includes/amp-helper-functions.php on line 659 https://wordpress.org/support/topic/line-error-shown-with-wp_debug/#post-10799506
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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
Hi Weston
I'm trying to add span tags around the dates so I can target each in a Google Tag Manager DOM variable I'm setting up for Structured Data purposes.
The HTML tags are being escaped and showing on the front end.
Is this something that you can help with?
Thank you for your time,
jules