Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry, I made a mistake, it should be if($mytime < 6){, as shown below:

    add_filter('the_time', 'dynamictime');
     function dynamictime() {
       global $post;
       $date = $post->post_date;
       $time = get_post_time('G', true, $post);
       $mytime = time() - $time;
       if($mytime < 60){
         $mytimestamp = __('Just now');
       }else{
         $mytimestamp = sprintf(__('%s ago'), human_time_diff($time));
       }
       return $mytimestamp;
     }

    I haven’t really tested it, but I think this should it:

    add_filter('the_time', 'dynamictime');
     function dynamictime() {
       global $post;
       $date = $post->post_date;
       $time = get_post_time('G', true, $post);
       $mytime = time() - $time;
       if($mytime > 60){
         $mytimestamp = __('Just now');
       }else{
         $mytimestamp = sprintf(__('%s ago'), human_time_diff($time));
       }
       return $mytimestamp;
     }

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