bbp_get_topic_post_date( int $topic_id, bool $humanize = false, bool $gmt = false )

Return the post date and time of a topic

Description

Parameters

$topic_id

(Optional) Topic id.

$humanize

(Optional) Humanize output using time_since

Default value: false

$gmt

(Optional) Use GMT

Default value: false

Return

(string)

Source

File: bp-forums/topics/template.php

817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
function bbp_get_topic_post_date( $topic_id = 0, $humanize = false, $gmt = false ) {
    $topic_id = bbp_get_topic_id( $topic_id );
 
    // 4 days, 4 hours ago
    if ( !empty( $humanize ) ) {
        $gmt_s  = !empty( $gmt ) ? 'U' : 'G';
        $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 );
        $time   = get_post_time( get_option( 'time_format' ), $gmt, $topic_id, true );
        $result = sprintf( _x( '%1$s at %2$s', 'date at time', 'buddyboss' ), $date, $time );
    }
 
    return apply_filters( 'bbp_get_topic_post_date', $result, $topic_id, $humanize, $gmt, $date, $time );
}

Changelog

Changelog
Version Description
bbPress (r4155) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.