Skip to content

Instantly share code, notes, and snippets.

@messaoudi-mounir
Last active August 6, 2017 02:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save messaoudi-mounir/8706592 to your computer and use it in GitHub Desktop.
Save messaoudi-mounir/8706592 to your computer and use it in GitHub Desktop.
Buddypress - Change activity & comments date format
//---------------------------------------------------//
// Change activity since time to exact data+time
//---------------------------------------------------//
add_filter('bp_activity_time_since', 'bp_activity_time_since_newformat', 10, 2);
function bp_activity_time_since_newformat( $time_since, &$actvitiy ) {
// you can change the date format to "Y-m-d H:i:s"
$time_since = '<span class="time-since">' . date_i18n("F j, Y", strtotime( $actvitiy->date_recorded ) ) . '</span>';
return $time_since;
}
add_filter('bp_activity_comment_date_recorded', 'bp_activity_comment_date_recorded_newformat', 10, 2);
function bp_activity_comment_date_recorded_newformat( $date_recorded ) {
global $activities_template;
// you can change the date format to "Y-m-d H:i:s"
$date_recorded = date_i18n("F j, Y", strtotime( $activities_template->activity->current_comment->date_recorded );
return $date_recorded;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment