mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://gist.github.com/rushijagani/c55ef3c788e86515a2298cbd06592c81 https://developers.wpastra.com/astra-theme/reference/functions/astra_post_date/
30 lines
816 B
Text
30 lines
816 B
Text
/**
|
|
* Function to get Date of Post without published date.
|
|
*/
|
|
if ( ! function_exists( 'astra_post_date' ) ) {
|
|
|
|
/**
|
|
* Function to get Date of Post
|
|
*
|
|
* @return html Markup.
|
|
*/
|
|
function astra_post_date() {
|
|
|
|
$output = '';
|
|
$format = apply_filters( 'astra_post_date_format', '' );
|
|
$time_string = esc_html( get_the_date( $format ) );
|
|
$modified_date = esc_html( get_the_modified_date( $format ) );
|
|
$posted_on = sprintf(
|
|
esc_html( '%s' ),
|
|
$time_string
|
|
);
|
|
$modified_on = sprintf(
|
|
esc_html( '%s' ),
|
|
$modified_date
|
|
);
|
|
$output .= '<span class="posted-on">';
|
|
$output .= '<span class="updated" itemprop="dateModified"> ' . $modified_on . '</span>';
|
|
$output .= '</span>';
|
|
return apply_filters( 'astra_post_date', $output );
|
|
}
|
|
}
|