Skip to content

Instantly share code, notes, and snippets.

@gmmedia
Last active Mar 2, 2021
Embed
What would you like to do?
Astra Theme: Display last modified and publisheddate in the post metadata.
/**
* 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