Displaying modified date instead of publish date

Sometime we want to show the modified date instead of publish date. Without modifying the core theme files, we can achieve it.

Open the functions.php file of your beaver child theme and add this simple snippet at end of the file.

4 Comments

  1. WP Beaver World on December 19, 2018 at 11:42 am

    Try this code once:

    add_filter( 'get_the_date', 'wpbw_display_modified_date', 90 );
    function wpbw_display_modified_date( $date )
    {
    	return __('Modified on:', 'fl-builder') . ' ' . get_the_modified_time( get_option( 'date_format' ) );
    }
  2. Mark Deit on December 19, 2018 at 4:40 am

    That’s great!
    Is there a way to add some code so it says – By Mark | Modified on: December 31, 2018 | 0
    Thanks
    Mark

    • WP Beaver World on December 19, 2018 at 11:43 am

      Try this code once:

      add_filter( 'get_the_date', 'wpbw_display_modified_date', 90 );
      function wpbw_display_modified_date( $date )
      {
      	return __('Modified on:', 'fl-builder') . ' ' . get_the_modified_time( get_option( 'date_format' ) );
      }
      • Mark on December 29, 2018 at 10:06 pm

        Works Great!!! Thank you!!!!

Leave a Comment





Newsletter

Get free weekly PRO Beaver Builder Tutorials

shares