Archived topic
Adding last updated code does not work on this theme?
3 replies · Started by Yerain on July 9, 2022
Hi, I found the perfect widget for what i'm trying to do on this blog post: https://ariel-lim.com/blog/show-last-modified-date-wordpress-website/. But it wont work on my theme? What gived, heres the code. any thoughts? Thanks a million in advanced! :)
// Published & Modified Date
function be_published_modified_date() {
$date = get_the_date( 'U' );
$updated = get_the_modified_date( 'U' );
$output = '<span class="entry-date"><span class="label">Published on</span> ' . get_the_date( 'F j, Y' ) . '</span>';
if( $updated > ( $date + MONTH_IN_SECONDS ) )
$output .= ' <span class="entry-date-modified"><span class="label">• Last updated</span> ' . get_the_modified_date( 'F j, Y' ) . '</span>';
return $output;
}
add_shortcode( 'be_published_modified_date', 'be_published_modified_date' );
Hi there,
i am not sure what you mean ? That code you shared creates a Shortcode, it won't change the dates what the theme displays, it will simply display a date wherever you add the [be_published_modified_date] shortcode.
AHHH! I see. ok thank you!
You're welcome