Code works in Child Theme, but not WPCode
-
The following code aligns the last modified date with the published date. It works in a child theme but does not work in WPCode. Does anyone know why?
<?php // Hook into the 'the_modified_date' filter for posts add_filter( 'the_modified_date', 'wpse_modified_date', 10, 2 ); // Hook into the 'the_time' filter for pages add_filter( 'the_time', 'wpse_modified_date', 10, 2 ); /** * Replace the published date with the last modified date. * * @param string $the_modified_date The current date string. * @param string $date_format The date format. * @return string The modified date string. */ function wpse_modified_date( $the_modified_date, $date_format ) { // Get the post object $post = get_post(); // Get the last modified date $modified_date = get_the_modified_date( $date_format, $post ); // Replace the published date with the modified date return $modified_date; } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Code works in Child Theme, but not WPCode’ is closed to new replies.