bbp_register_theme_package

Register a new bbPress theme package to the active theme packages array.

Description

bbp_register_theme_package( (array) $theme = array(), (bool) $override = true ); 

Parameters (2)

0. $theme — Optional. (array) => array()
The theme.
1. $override — Optional. (bool) => true
The override.

Usage

  1. if ( !function_exists( 'bbp_register_theme_package' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/theme-compat.php'; 
  3.  
  4. // The theme. 
  5. $theme = array(); 
  6.  
  7. // The override. 
  8. $override = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_register_theme_package($theme, $override); 
  12.  

Defined (1)

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

/includes/core/theme-compat.php  
  1. function bbp_register_theme_package( $theme = array(), $override = true ) { 
  2.  
  3. // Create new BBP_Theme_Compat object from the $theme array 
  4. if ( is_array( $theme ) ) 
  5. $theme = new BBP_Theme_Compat( $theme ); 
  6.  
  7. // Bail if $theme isn't a proper object 
  8. if ( ! is_a( $theme, 'BBP_Theme_Compat' ) ) 
  9. return; 
  10.  
  11. // Load up bbPress 
  12. $bbp =bbpress); 
  13.  
  14. // Only override if the flag is set and not previously registered 
  15. if ( empty( $bbp->theme_compat->packages[$theme->id] ) || ( true === $override ) ) { 
  16. $bbp->theme_compat->packages[$theme->id] = $theme;