Support » Theme: Twenty Twenty-One » Show Update date instead of Published date

  • Resolved Biche



    I’ve recently started using the Twenty Twenty-One theme, and I’ve got a bit of a problem.

    At the bottom of each post, I see a line that says ‘Published’ followed by the date that a post was published on.

    I was wondering: is there any way I can change that to ‘Updated on’ followed by the date when the post was last updated.

    If so, I’d appreciated any help with this.

    Thanks in advance!


Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    Yes, you could define the twenty_twenty_one_posted_on() function in a plugin or child theme’s functions.php which would then override the theme’s version as follows (using get_the_modified_date() function instead of get_the_date() function) …

    if ( ! function_exists( 'twenty_twenty_one_posted_on' ) ) {
    	 * Prints HTML with meta information for the updated on post-date/time.
    	 * @since Twenty Twenty-One 1.5
    	 * @return void
    	function twenty_twenty_one_posted_on() {
    		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
    		$time_string = sprintf(
    			esc_attr( get_the_modified_date( DATE_W3C ) ),
    			esc_html( get_the_modified_date() )
    		echo '<span class="posted-on">';
    			/* translators: %s: Updated date. */
    			esc_html__( 'Updated %s', 'twentytwentyone' ),
    			$time_string // phpcs:ignore WordPress.Security.EscapeOutput
    		echo '</span>';


    Thread Starter Biche


    Thanks a lot, Oliver.

    That worked like a charm! šŸ™‚

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.