buddyboss_global_search_load_template

The BuddyPress Global Search buddyboss global search load template function.

Description

buddyboss_global_search_load_template( $template, (bool) $variation = false ); 

Parameters (2)

0. $template
The template.
1. $variation — Optional. (bool) => false
The variation.

Usage

  1. if ( !function_exists( 'buddyboss_global_search_load_template' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-global-search/includes/template.php'; 
  3.  
  4. // The template. 
  5. $template = null; 
  6.  
  7. // The variation. 
  8. $variation = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = buddyboss_global_search_load_template($template, $variation); 
  12.  

Defined (1)

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

/includes/template.php  
  1. function buddyboss_global_search_load_template( $template, $variation=false ) { 
  2. $file = $template; 
  3.  
  4. if( $variation ) { 
  5. $file .= '-' . $variation; 
  6. $file .= '.php'; 
  7.  
  8. $file_found = false; 
  9. //first try to load template-variation.php 
  10. if( file_exists(STYLESHEETPATH.'/buddypress-global-search/'.$file ) ) { 
  11. include (STYLESHEETPATH.'/buddypress-global-search/'.$file); 
  12. $file_found = true; 
  13. } else if(file_exists(TEMPLATEPATH.'/buddypress-global-search/'.$file)) { 
  14. include (TEMPLATEPATH.'/buddypress-global-search/'.$file); 
  15. $file_found = true; 
  16. } else if(file_exists(BUDDYBOSS_GLOBAL_SEARCH_PLUGIN_DIR.'templates/'.$file)) { 
  17. include (BUDDYBOSS_GLOBAL_SEARCH_PLUGIN_DIR.'templates/'.$file); 
  18. $file_found = true; 
  19.  
  20. if( !$file_found && $variation != '' ) { 
  21. //then try to load template.php 
  22. $file = $template . '.php'; 
  23. if( file_exists(STYLESHEETPATH.'/buddypress-global-search/'.$file ) ) { 
  24. include (STYLESHEETPATH.'/buddypress-global-search/'.$file); 
  25. } else if(file_exists(TEMPLATEPATH.'/buddypress-global-search/'.$file)) { 
  26. include (TEMPLATEPATH.'/buddypress-global-search/'.$file); 
  27. } else if(file_exists(BUDDYBOSS_GLOBAL_SEARCH_PLUGIN_DIR.'templates/'.$file)) { 
  28. include (BUDDYBOSS_GLOBAL_SEARCH_PLUGIN_DIR.'templates/'.$file);