Created
February 29, 2024 10:19
-
-
Save KaineLabs/2c66cedca89ebc96ba5b4db026e0ec84 to your computer and use it in GitHub Desktop.
BuddyPress - Youzify Change Time Stamp Format both for Comments and Posts:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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("Y-m-d H:i", 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 = '<span class="time-since">' . date_i18n("F j, Y", strtotime( | |
$activities_template->activity->current_comment->date_recorded ) ) . '</span>'; | |
return $date_recorded; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment