BBP_Shortcodes::display_topics_of_tag( array $attr, string $content = '' )
Display the contents of a specific topic tag in an output buffer and return to ensure that post/page contents are displayed first.
Description
Parameters
- $attr
-
(Required)
- $content
-
(Optional)
Default value: ''
Return
(string)
Source
File: bp-forums/common/shortcodes.php
public function display_topics_of_tag( $attr, $content = '' ) {
// Sanity check required info
if ( !empty( $content ) || ( empty( $attr['id'] ) || !is_numeric( $attr['id'] ) ) )
return $content;
// Unset globals
$this->unset_globals();
// Filter the query
if ( ! bbp_is_topic_tag() ) {
add_filter( 'bbp_before_has_topics_parse_args', array( $this, 'display_topics_of_tag_query' ) );
}
// Start output buffer
$this->start( 'bbp_topic_tag' );
// Set passed attribute to $ag_id for clarity
bbpress()->current_topic_tag_id = $tag_id = $attr['id'];
// Output template
bbp_get_template_part( 'content', 'archive-topic' );
// Return contents of output buffer
return $this->end();
}
Changelog
| Version | Description |
|---|---|
| bbPress (r3110) | 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.