bbp_get_topic_tag_description( array $args = array() )

Return the description of the current tag

Description

Parameters

$args

(Optional) before|after|tag

Default value: array()

Return

(string) Term Name

Source

File: bp-forums/topics/template.php

3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
function bbp_get_topic_tag_description( $args = array() ) {
 
    // Parse arguments against default values
    $r = bbp_parse_args( $args, array(
        'before' => '<div class="bbp-topic-tag-description"><p>',
        'after'  => '</p></div>',
        'tag'    => ''
    ), 'get_topic_tag_description' );
 
    // Get the term
    if ( ! empty( $r['tag'] ) ) {
        $term = get_term_by( 'slug', $r['tag'], bbp_get_topic_tag_tax_id() );
    } else {
        $tag      = get_query_var( 'term' );
        $r['tag'] = $tag;
        $term     = get_queried_object();
    }
 
    // Add before and after if description exists
    if ( !empty( $term->description ) ) {
        $retval = $r['before'] . $term->description . $r['after'];
 
    // No description, no HTML
    } else {
        $retval = '';
    }
 
    return apply_filters( 'bbp_get_topic_tag_description', $retval, $r );
}

Changelog

Changelog
Version Description
bbPress (r3109) 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.