Title: Post Modified Time
Last modified: August 21, 2016

---

# Post Modified Time

 *  [X-Raym](https://wordpress.org/support/users/x-raym/)
 * (@x-raym)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/post-modified-time/)
 * Hi !
 * I want to display the_modified_date next to the_date (in the loop or in single),
   only if the post was modified, and more than 3 hours after its published time.
 * I usually use something like this directly on single.php :
 *     ```
       <?php
       define ('DELAY_POST_UPDATE_DISPLAY', 3);
       if (get_the_modified_date() != get_the_date() || get_the_modified_time('Gi') - get_the_time('Gi') >= DELAY_POST_UPDATE_DISPLAY * 100) :
       ?>
           <time datetime="<?php the_modified_time('c');?>"><?php the_modified_time('j F Y \à H:i'); ?></time>
       <?php
       endif;
       ?>
       ```
   
 * …but for some kind of reason, I don’t succeed to implement it well, either in
   single.php or using function.php. The modified time appears all the time, even
   is the post hasn’t be modified. I have to say I’m not a php developer, I don’t
   know if I did the thing right, but i succeed on three other themes, and not in
   this one =/
 * I know i have to modify the highwind_post_date in functions.php. This is how 
   far i get without breaking the theme (and without the “if” statement)
 *     ```
       // custom post date and modified time
       if ( ! function_exists( 'highwind_post_date' ) ) {
       	function highwind_post_date() {
       		if ( ! is_page() && ! is_404() ) {
       		?>
       			<time datetime="<?php the_time('c');?>" class="post-date"><a 
   
       href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'highwind' ), 
   
       the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_time( get_option( 'date_format' ) ); ?
   
       ></a></time>
       			<time datetime="<?php the_modified_time('c');?>" class="post-
   
       modified-date"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 
   
       'highwind' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_modified_time( 
   
       get_option( 'date_format' ) ); ?></a></time>
   
       		<?php
       		}
       	}
       }
       ```
   
 * Can you please help me on this ? 🙂
 * Thanks ! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [X-Raym](https://wordpress.org/support/users/x-raym/)
 * (@x-raym)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/post-modified-time/#post-4865750)
 * no more success with :
 * `http://willrees.com/2013/06/show-the-latest-update-time-and-date-for-a-wordpress-
   page-or-post/`
 * =/
 * any idea ?
 *  Thread Starter [X-Raym](https://wordpress.org/support/users/x-raym/)
 * (@x-raym)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/post-modified-time/#post-4865772)
 * Did it !
 * actually it was “quite” simple, i just need to learn more about my php synthax
   ^^
 * here is the code !
 *     ```
       // custom post date and modified time
       if ( ! function_exists( 'highwind_post_date' ) ) {
       	function highwind_post_date() {
       		if ( ! is_page() && ! is_404() ) {
       		?>
       			<time datetime="<?php the_time('c');?>" class="post-date"><?php the_time( get_option( 'date_format' ) ); ?></time>
       			<?php
       define ('DELAY_POST_UPDATE_DISPLAY', 3);
   
       if (get_the_modified_date() != get_the_date() || get_the_modified_time('Gi') - get_the_time('Gi') >= DELAY_POST_UPDATE_DISPLAY * 100) :
       ?>
           <time datetime="<?php the_modified_time('c');?>" class="post-modified-date"><?php the_modified_time( get_option( 'date_format' ) ); ?></a></time>
       <?php
       endif;
       ?>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post Modified Time’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/highwind/1.2.7/screenshot.png)
 * Highwind
 * [Support Threads](https://wordpress.org/support/theme/highwind/)
 * [Active Topics](https://wordpress.org/support/theme/highwind/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/highwind/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/highwind/reviews/)

## Tags

 * [modified time](https://wordpress.org/support/topic-tag/modified-time/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 1 participant
 * Last reply from: [X-Raym](https://wordpress.org/support/users/x-raym/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/post-modified-time/#post-4865772)
 * Status: not resolved