Skip to content

Commit

Permalink
fix(homepage-posts): handle "time ago" format in HBP
Browse files Browse the repository at this point in the history
  • Loading branch information
adekbadek committed May 9, 2024
1 parent 98c9560 commit e4e8af5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions newspack-theme/inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,9 @@ function newspack_convert_to_time_ago( $post_time, $format, $post ) {
return $post_time;
}
add_filter( 'get_the_date', 'newspack_convert_to_time_ago', 10, 3 );
add_filter( 'newspack_blocks_formatted_displayed_post_date', function($date_formatted, $post){
return newspack_math_to_time_ago( $date_formatted, '', $post, false );
}, 10, 3 );

/**
* Apply time ago format to modified dates if enabled.
Expand Down

0 comments on commit e4e8af5

Please sign in to comment.