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
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
| 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.