bbp_template_include_theme_supports( string $template = '' )
Possibly intercept the template being loaded
Description
Listens to the ‘template_include’ filter and waits for any Forums specific template condition to be met. If one is met and the template file exists, it will be used; otherwise
Note that the _edit() checks are ahead of their counterparts, to prevent them from being stomped on accident.
Parameters
- $template
-
(Optional)
Default value: ''
Return
(string) The path to the template file that is being used
Source
File: bp-forums/core/template-loader.php
function bbp_template_include_theme_supports( $template = '' ) {
// Editing a user
if ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template() ) ) :
// User favorites
elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template() ) ) :
// User favorites
elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template() ) ) :
// Viewing a user
elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) :
// Single View
elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) :
// Search
elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) :
// Forum edit
elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) :
// Single Forum
elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template() ) ) :
// Forum Archive
elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template() ) ) :
// Topic merge
elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) :
// Topic split
elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) :
// Topic edit
elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) :
// Single Topic
elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template() ) ) :
// Topic Archive
elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) :
// Reply move
elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) :
// Editing a reply
elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) :
// Single Reply
elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template() ) ) :
// Editing a topic tag
elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) :
// Viewing a topic tag
elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) :
endif;
// A Forums template file was located, so override the WordPress template
// and use it to switch off Forums' theme compatibility.
if ( !empty( $new_template ) ) {
$template = bbp_set_template_included( $new_template );
}
return apply_filters( 'bbp_template_include_theme_supports', $template );
}
Changelog
| Version | Description |
|---|---|
| bbPress (r3032) | 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.