bp_detect_theme_compat_with_current_theme

Set our flag to determine whether theme compat should be enabled.

Description

bp_detect_theme_compat_with_current_theme(); 

Theme compat is disabled when a theme meets one of the following criteria: 1) It declares BP support with add_theme_support( buddypress ) 2) It is bp-default, or a child theme of bp-default 3) A legacy template is found at members/members-loop.php. This is a


Usage

  1. if ( !function_exists( 'bp_detect_theme_compat_with_current_theme' ) ) { 
  2. require_once '/bp-core/bp-core-theme-compatibility.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_detect_theme_compat_with_current_theme(); 
  7.  

Defined (1)

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

/bp-core/bp-core-theme-compatibility.php  
  1. function bp_detect_theme_compat_with_current_theme() { 
  2. if ( isset( buddypress()->theme_compat->use_with_current_theme ) ) { 
  3. return buddypress()->theme_compat->use_with_current_theme; 
  4.  
  5. // Theme compat enabled by default. 
  6. $theme_compat = true; 
  7.  
  8. // If the theme supports 'buddypress', bail. 
  9. if ( current_theme_supports( 'buddypress' ) ) { 
  10. $theme_compat = false; 
  11.  
  12. // If the theme doesn't support BP, do some additional checks. 
  13. } else { 
  14. // Bail if theme is a derivative of bp-default. 
  15. if ( in_array( 'bp-default', array( get_template(), get_stylesheet() ) ) ) { 
  16. $theme_compat = false; 
  17.  
  18. // Brute-force check for a BP template. 
  19. // Examples are clones of bp-default. 
  20. } elseif ( locate_template( 'members/members-loop.php', false, false ) ) { 
  21. $theme_compat = false; 
  22.  
  23. // Set a flag in the buddypress() singleton so we don't have to run this again. 
  24. buddypress()->theme_compat->use_with_current_theme = $theme_compat; 
  25.  
  26. return $theme_compat;