Permalink
Browse files

Fix post timestamps. Was using incorrect method to fetch GMT time of

posts for relative time display.

Go ahead and make images max-width: 100% instead of 90%

Use text-overflow: ellipsis for post content, just in case.
  • Loading branch information...
1 parent 0abc115 commit ccf78fa97ab249ab188990ce6988b48da2ee0d43 Dougal Campbell committed May 11, 2011
Showing with 12 additions and 8 deletions.
  1. +10 −7 functions.php
  2. +2 −1 style.css
View
17 functions.php
@@ -57,7 +57,7 @@
if ( $is_iphone || $is_ipad || $is_ipod )
$is_ios = true;
-$formattd_css_version = '0.0.18';
+$formattd_css_version = '0.0.19';
/**
* Set the content width based on the theme's design and stylesheet.
@@ -604,14 +604,16 @@ function formattd_extract_first_link($post) {
endif;
if (! function_exists('formattd_time_ago') ) :
-function formattd_time_ago($timestamp=0, $granularity=2, $format='Y-m-d H:i:s'){
+function formattd_time_ago($timestamp=0, $granularity=2, $format='Y-m-d H:i:s') {
if ( 0 === $timestamp ) {
- $timestamp = get_the_time("U");
+ // fetch the post time in UTC
+ $timestamp = get_post_time('U', true);
}
+
$difference = time() - $timestamp;
- if($difference < 0) return 'just now';
+ if($difference < 0) return sprintf( '<span title="%s">%s</span>', esc_attr(date('c', $timestamp)), 'Not yet...') ;
elseif($difference < 31536000){
- $periods = array('mon' => 2592000, 'wk' => 604800,'day' => 86400,'hr' => 3600,'min' => 60,'sec' => 1);
+ $periods = array('mon' => 2592000, 'wk' => 604800,'day' => 86400,'hr' => 3600,'min' => 60 );
$output = '';
foreach($periods as $key => $value){
if($difference >= $value){
@@ -623,9 +625,10 @@ function formattd_time_ago($timestamp=0, $granularity=2, $format='Y-m-d H:i:s')
}
if($granularity == 0) break;
}
- return ($output ? $output : 'Just now').' ago';
+ $output = ($output ? $output : 'Just now').' ago';
+ return sprintf('<span title="%s">%s</span>', esc_attr(date('c',$timestamp)) ,$output);
}
- else return date($format, $timestamp);
+ else return sprintf( '<span title="%s">%s</span>', esc_attr(date('c', $timestamp)), date($format, $timestamp) );
}
endif;
View
3 style.css
@@ -412,6 +412,7 @@ article {
position: relative;
margin-bottom: 4em;
clear: both;
+ text-overflow: ellipsis;
}
article header{
@@ -561,7 +562,7 @@ article.format-standard div.gallery {
}
#content article img {
- max-width: 90%;
+ max-width: 100%;
}
dl.gallery-item {

0 comments on commit ccf78fa

Please sign in to comment.