You can make this change in a child theme, so your tweaks won’t be overwritten when you update the theme. If you’re new to child themes, you can explore these guides:
https://codex.www.ads-software.com/Child_Themes
https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/
https://vimeo.com/39023468
Keeping your theme up-to-date is strongly recommended to ensure you get bug fixes, security updates, and updates to keep the theme compatible with WordPress core.
Once your child theme is set up, you’ll need to copy the posted_on()
date function from /inc/template-tags
into your child theme’s functions.php
file:
function apostrophe_posted_on() {
$human_time = apostrophe_human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) );
$regular_time = get_the_time( get_option( 'date_format' ) );
$output_time = sprintf( '%s <span style="display:none;">%s</span>', esc_html( $human_time ), esc_html( $regular_time ) );
if ( current_time( 'timestamp' ) > get_the_time( 'U' ) + 60 * 60 * 24 * 14 ) {
$output_time = esc_html( $regular_time );
}
printf( '<a class="entry-date published" href="%s">%s</a>', esc_url( get_permalink() ), $output_time ); // WPCS: XSS OK.
printf( '<time class="updated" datetime="%s">%s</time>', esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) );
printf( '<span class="byline vcard"><a class="url fn n" href="%s">%s</a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() );
}
// endif;
Change this line from:
printf( '<a class="entry-date published" href="%s">%s</a>', esc_url( get_permalink() ), $output_time ); // WPCS: XSS OK.
to this:
printf( '<a class="entry-date published" href="%s">%s</a>', esc_url( get_permalink() ), $regular_time ); // WPCS: XSS OK.
That should eliminate the relative dates and give you full dates, no matter when something was posted.
Let me know how it goes.