- 
		Author
- 
		
			
				
March 20, 2015 at 23:00 #50998juandias ParticipantHow can i limit update time to just hours/days and not seconds March 23, 2015 at 18:07 #51201Radu ModeratorHello, 1 Hour = 3600000 miliseconds 
 2 Hours = 7200000 miliseconds
 6 Hours = 21600000 miliseconds
 12 Hours = 43200000 miliseconds
 24 Hours = 86400000 milisecondsJust convert hours or days to miliseconds. Cheers Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMarch 23, 2015 at 23:37 #51281juandias ParticipantSorry, where i find that configuration? i cant find it. Thanks. March 24, 2015 at 01:57 #51295juandias ParticipantI want the update time in 
 https://www.dropbox.com/s/t07jrdt9edqd7az/Captura%20de%20pantalla%202015-03-23%2019.00.54.png?dl=0as in the template 
 https://www.dropbox.com/s/h8j075k4il5s0la/Captura%20de%20pantalla%202015-03-23%2019.01.18.png?dl=0I mean, not wirh much details… just hours, or days. not minutes, nor seconds. How can I do that? and where ? 
 thank you!March 24, 2015 at 18:45 #51365Radu ModeratorHello, Try with this code Add this code in kleo-child functions.php COPY CODE/** * Modify bbp_get_time_since() output * -------------------------------------------------------------------------------------------*/ add_filter('bbp_get_time_since', 'aq_get_time_since', 10, 3); function aq_get_time_since( $output, $older_date, $newer_date ) { // Setup the strings $unknown_text = apply_filters( 'bbp_core_time_since_unknown_text', __( 'sometime', 'bbpress' ) ); $right_now_text = apply_filters( 'bbp_core_time_since_right_now_text', __( 'right now', 'bbpress' ) ); $ago_text = apply_filters( 'bbp_core_time_since_ago_text', __( '%s ago', 'bbpress' ) ); // array of time period chunks $chunks = array( array( 60 * 60 * 24 * 365 , __( 'year', 'bbpress' ), __( 'years', 'bbpress' ) ), array( 60 * 60 * 24 * 30 , __( 'month', 'bbpress' ), __( 'months', 'bbpress' ) ), array( 60 * 60 * 24 * 7, __( 'week', 'bbpress' ), __( 'weeks', 'bbpress' ) ), array( 60 * 60 * 24 , __( 'day', 'bbpress' ), __( 'days', 'bbpress' ) ), array( 60 * 60 , __( 'hour', 'bbpress' ), __( 'hours', 'bbpress' ) ), array( 60 , __( 'minute', 'bbpress' ), __( 'minutes', 'bbpress' ) ), array( 1, __( 'second', 'bbpress' ), __( 'seconds', 'bbpress' ) ) ); if ( !empty( $older_date ) && !is_numeric( $older_date ) ) { $time_chunks = explode( ':', str_replace( ' ', ':', $older_date ) ); $date_chunks = explode( '-', str_replace( ' ', '-', $older_date ) ); $older_date = gmmktime( (int) $time_chunks[1], (int) $time_chunks[2], (int) $time_chunks[3], (int) $date_chunks[1], (int) $date_chunks[2], (int) $date_chunks[0] ); } // $newer_date will equal false if we want to know the time elapsed // between a date and the current time. $newer_date will have a value if // we want to work out time elapsed between two known dates. $newer_date = ( !$newer_date ) ? strtotime( current_time( 'mysql' ) ) : $newer_date; // Difference in seconds $since = $newer_date - $older_date; // Something went wrong with date calculation and we ended up with a negative date. if ( 0 > $since ) { $output = $unknown_text; // We only want to output two chunks of time here, eg: // x years, xx months // x days, xx hours // so there's only two bits of calculation below: } else { // Step one: the first chunk for ( $i = 0, $j = count( $chunks ); $i < $j; ++$i ) { $seconds = $chunks[$i][0]; // Finding the biggest chunk (if the chunk fits, break) $count = floor( $since / $seconds ); if ( 0 != $count ) { break; } } // If $i iterates all the way to $j, then the event happened 0 seconds ago if ( !isset( $chunks[$i] ) ) { $output = $right_now_text; } else { // Set output var $output = ( 1 == $count ) ? '1 '. $chunks[$i][1] : $count . ' ' . $chunks[$i][2]; // No output, so happened right now if ( ! (int) trim( $output ) ) { $output = $right_now_text; } } } return $output; }Let me know if it works Cheers Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMay 2, 2015 at 11:53 #57031joy ParticipantHello, that code does not show the hours. I had a post with a freshness of 1 day and 7 hours ago. It dropped the 7 hours and only displays as 1 day. I would like the freshness to show the same way as this forums does. It just minutes, until it reaches an hour, then only hours, then days and hours, etc. But it does not display the word “ago”. Can you help? Thank you. May 6, 2015 at 14:40 #57568Radu ModeratorHello, That function it’s identically like this on this forum. If this function does not help you, you can modify it… Cheers Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
- 
		AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.
 
							
						
