posted_time

The Facebook Feed posted time function.

Description

posted_time( $time ); 

Parameters (1)

0. $time
The time.

Usage

  1. if ( !function_exists( 'posted_time' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'facebook-feed/facebook-feed-shortcode.php'; 
  3.  
  4. // The time. 
  5. $time = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = posted_time($time); 
  9.  

Defined (1)

The function is defined in the following location(s).

/facebook-feed-shortcode.php  
  1. function posted_time($time) 
  2. $time = time() - $time; // to get the time since that moment 
  3.  
  4. $time_units = array ( 
  5. 31536000 => 'year',  
  6. 2592000 => 'month',  
  7. 604800 => 'week',  
  8. 86400 => 'day',  
  9. 3600 => 'hour',  
  10. 60 => 'minute',  
  11. 1 => 'second' 
  12. ); 
  13.  
  14. foreach ($time_units as $unit => $text) { 
  15. if ($time < $unit) continue; 
  16. $numberOfUnits = floor($time / $unit); 
  17. return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':''); 
  18.