Skip to content

Instantly share code, notes, and snippets.

@smtechno
Created April 13, 2022 14:37
Show Gist options
  • Save smtechno/dbd73745b4d66dd338f2e939365ef042 to your computer and use it in GitHub Desktop.
Save smtechno/dbd73745b4d66dd338f2e939365ef042 to your computer and use it in GitHub Desktop.
Last Date Untuk Astra Theme
/*-----last update date code for Astra Theme only-----*/
function your_prefix_post_date( $output ) {
if ( 'post' === get_post_type() ) {
$the_time = get_post_time( 'His' );
$the_modified = get_post_modified_time( 'His' );
$last_modified = sprintf( __( 'Last updated %s', 'astra' ), esc_html( get_post_modified_time( 'M j, Y' ) ) );
$published = sprintf( __( 'Published on %s', 'astra' ), esc_html( get_post_time( 'M j, Y' ) ) );
$date = $the_modified !== $the_time ? $last_modified . ' | ' . $published : $published;
return $date;
}
}
add_filter( 'astra_post_date', 'your_prefix_post_date' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment