add_action( 'bbp_theme_after_topic_started_by' , 'rew_add_date' );
function rew_add_date () {
echo ' on ' ;
bbp_topic_post_date() ;
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
Great Robin it works ! thanks 🙂
i will need to manually change html on the topics listings (forum) template, which file should i edit then ? (i want to rename “started by”, change the way freshness avatar is showing with html (not possible with css) etc
and therefore is there a way to manually add this date directly on that file ?
Thanks 🙂
Hi Robin
I have your function that you gave me above :
// FORUM ADD DATE OF TOPIC CREATION
add_action( 'bbp_theme_after_topic_started_by' , 'rew_add_date' );
function rew_add_date () {
echo ' on ' ;
bbp_topic_post_date() ;
}
I would like to show only the date and remove the time ie :
August 4 2012 instead of August 4 2012 at 2:37 pm
how can i get that ?
thanks !
untested, but this should work
add_filter( 'bbp_get_topic_post_date', 'rew_date_only' , 20, 6) ;
function rew_date_only ($result, $topic_id, $humanize, $gmt, $date, $time ){
$topic_id = bbp_get_topic_id( $topic_id );
// 4 days, 4 hours ago
if ( ! empty( $humanize ) ) {
$gmt_s = ! empty( $gmt ) ? 'G' : 'U';
$date = get_post_time( $gmt_s, $gmt, $topic_id );
$time = false; // For filter below
$result = bbp_get_time_since( $date );
// August 4, 2012 at 2:37 pm
} else {
$date = get_post_time( get_option( 'date_format' ), $gmt, $topic_id, true );
$result = $date;
}
// Filter & return
return apply_filters( 'rew_date_only', $result, $topic_id, $humanize, $gmt, $date, $time );
}
}
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
Thanks
it works like a charm 🙂