Skip to content

Instantly share code, notes, and snippets.

@gmmedia
Last active March 11, 2023 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmmedia/bc6ea0cc4923ba68a56697f6ea88a4a0 to your computer and use it in GitHub Desktop.
Save gmmedia/bc6ea0cc4923ba68a56697f6ea88a4a0 to your computer and use it in GitHub Desktop.
Astra Theme: Display last modified and publisheddate in the post metadata.
<?php
/**
* Astra Theme: Display last modified and published date in the post metadata.
* See: https://j0e.org/astra-tipps-tricks/
*/
function j0e_post_date( $output ) {
$output = '';
$format = apply_filters( 'astra_post_date_format', '' );
$published_date = esc_html( get_the_date( $format ) );
$published_on = sprintf(
esc_html( '%s' ),
$published_date
);
$modified_date = esc_html( get_the_modified_date( $format ) );
$modified_on = sprintf(
esc_html( '%s' ),
$modified_date
);
$output .= '';
$output .= 'Aktualisiert: ' . $modified_on . ' | Erstausgabe: ' . $published_on;
$output .= '';
return $output;
}
add_filter( 'astra_post_date', 'j0e_post_date' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment