Skip to content

Commit

Permalink
Merge pull request #94 from OpenSourceOrg/fix/blog-post-date
Browse files Browse the repository at this point in the history
Don't display the updated date for blog posts but published date
  • Loading branch information
geoffguillain authored Jun 18, 2024
2 parents 43d9210 + c3d4987 commit d6697e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions themes/osi/inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
if ( ! function_exists( 'osi_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @param string $format Date format.
*/
function osi_posted_on( $format = '' ) {

$time_string = '<time class="byline--date entry-date published" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="byline--date entry-date published updated" datetime="%3$s">%4$s</time>';

// Don't display the updated date for blog posts.
if ( 'post' !== get_post_type() ) {
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="byline--date entry-date published updated" datetime="%3$s">%4$s</time>';
}
}

$time_string = sprintf(
Expand All @@ -32,7 +38,6 @@ function osi_posted_on( $format = '' ) {
);

echo '<span class="posted-on">' . $posted_on . '</span>'; // phpcs:ignore

}
endif;

Expand Down

0 comments on commit d6697e5

Please sign in to comment.