Advertisement
fahimmurshed

Show post publish date and last modified date together

Mar 5th, 2021 (edited)
1,494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. function your_prefix_post_date( $output ) {
  2.     $format        = apply_filters( 'astra_post_date_format', '' );
  3.     $modified_date = esc_html( get_the_modified_date( $format ) );
  4.     $modified_on   = sprintf(
  5.         esc_html( '%s' ),
  6.         $modified_date
  7.     );
  8.     $updated_output = '';
  9.     $separator = ' /';
  10.     $separator = apply_filters( 'astra_post_meta_separator', $separator );
  11.     $published_string = _x('Published : ' , 'astra');
  12.     $updated_string = _('' . $separator . ' Updated : ' , 'astra' );
  13.     $updated_output       .= '';
  14.     $updated_output       .= ' ' . $modified_on . '';
  15.     $updated_output       .= '';
  16.     $modified_output = $published_string . $output . $updated_string . $updated_output;
  17.     return $modified_output;
  18. }
  19. add_filter( 'astra_post_date', 'your_prefix_post_date' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement