bbp_template_include_theme_supports

Possibly intercept the template being loaded.

Description

(string) bbp_template_include_theme_supports( (string) $template = '' ); 

Listens to the template_include filter and waits for any bbPress 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.

Returns (string)

The path to the template file that is being used

Parameters (1)

0. $template — Optional. (string) => ''
The template.

Usage

  1. if ( !function_exists( 'bbp_template_include_theme_supports' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/template-loader.php'; 
  3.  
  4. // The template. 
  5. $template = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_template_include_theme_supports($template); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/core/template-loader.php  
  1. function bbp_template_include_theme_supports( $template = '' ) { 
  2.  
  3. // Editing a user 
  4. if ( bbp_is_single_user_edit() && ( $new_template = bbp_get_single_user_edit_template() ) ) : 
  5.  
  6. // User favorites 
  7. elseif ( bbp_is_favorites() && ( $new_template = bbp_get_favorites_template() ) ) : 
  8.  
  9. // User favorites 
  10. elseif ( bbp_is_subscriptions() && ( $new_template = bbp_get_subscriptions_template() ) ) : 
  11.  
  12. // Viewing a user 
  13. elseif ( bbp_is_single_user() && ( $new_template = bbp_get_single_user_template() ) ) : 
  14.  
  15. // Single View 
  16. elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : 
  17.  
  18. // Search 
  19. elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) : 
  20.  
  21. // Forum edit 
  22. elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) : 
  23.  
  24. // Single Forum 
  25. elseif ( bbp_is_single_forum() && ( $new_template = bbp_get_single_forum_template() ) ) : 
  26.  
  27. // Forum Archive 
  28. elseif ( bbp_is_forum_archive() && ( $new_template = bbp_get_forum_archive_template() ) ) : 
  29.  
  30. // Topic merge 
  31. elseif ( bbp_is_topic_merge() && ( $new_template = bbp_get_topic_merge_template() ) ) : 
  32.  
  33. // Topic split 
  34. elseif ( bbp_is_topic_split() && ( $new_template = bbp_get_topic_split_template() ) ) : 
  35.  
  36. // Topic edit 
  37. elseif ( bbp_is_topic_edit() && ( $new_template = bbp_get_topic_edit_template() ) ) : 
  38.  
  39. // Single Topic 
  40. elseif ( bbp_is_single_topic() && ( $new_template = bbp_get_single_topic_template() ) ) : 
  41.  
  42. // Topic Archive 
  43. elseif ( bbp_is_topic_archive() && ( $new_template = bbp_get_topic_archive_template() ) ) : 
  44.  
  45. // Reply move 
  46. elseif ( bbp_is_reply_move() && ( $new_template = bbp_get_reply_move_template() ) ) : 
  47.  
  48. // Editing a reply 
  49. elseif ( bbp_is_reply_edit() && ( $new_template = bbp_get_reply_edit_template() ) ) : 
  50.  
  51. // Single Reply 
  52. elseif ( bbp_is_single_reply() && ( $new_template = bbp_get_single_reply_template() ) ) : 
  53.  
  54. // Editing a topic tag 
  55. elseif ( bbp_is_topic_tag_edit() && ( $new_template = bbp_get_topic_tag_edit_template() ) ) : 
  56.  
  57. // Viewing a topic tag 
  58. elseif ( bbp_is_topic_tag() && ( $new_template = bbp_get_topic_tag_template() ) ) : 
  59. endif; 
  60.  
  61. // A bbPress template file was located, so override the WordPress template 
  62. // and use it to switch off bbPress's theme compatibility. 
  63. if ( !empty( $new_template ) ) { 
  64. $template = bbp_set_template_included( $new_template ); 
  65.  
  66. return apply_filters( 'bbp_template_include_theme_supports', $template );