Astra by default displays the date when a post was published to your website visitors. Plus it adds the date when the post was last updated in the code – for SEO and Schema Markup.
![Astra Date Option](../../wp-content/uploads/2018/05/date-astra.png)
Published date is displayed in the front end
![Date in Code Astra](../../wp-content/uploads/2018/05/date-in-code-astra.png)
Both, published as well as updated dates are available in the markup.
If you want to display last updated date for the post to your visitors, use the following custom code –
/**
* Display only last modified date in the post metadata.
*
* @param String $output Markup for the last modified date.
* @return void
*/
function your_prefix_post_date( $output ) {
$output = '';
$format = apply_filters( 'astra_post_date_format', '' );
$modified_date = esc_html( get_the_modified_date( $format ) );
$modified_on = sprintf(
esc_html( '%s' ),
$modified_date
);
$output .= '';
$output .= ' ' . $modified_on . '';
$output .= '';
return $output;
}
add_filter( 'astra_post_date', 'your_prefix_post_date' );
It hides the published date and makes updated date visible.
Note:
Add the above code into the child theme’s functions.php file.