umf_template_override

The WordPress Core umf template override function.

Description

umf_template_override( $template, (string) $template_name, $template_path ); 

Parameters (3)

0. $template
The template.
1. $template_name (string)
The template name.
2. $template_path
The template path.

Usage

  1. if ( !function_exists( 'umf_template_override' ) ) { 
  2. require_once '/woocommerce-upload-my-file.php'; 
  3.  
  4. // The template. 
  5. $template = null; 
  6.  
  7. // The template name. 
  8. $template_name = ''; 
  9.  
  10. // The template path. 
  11. $template_path = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = umf_template_override($template, $template_name, $template_path); 
  15.  

Defined (1)

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

/woocommerce-upload-my-file.php  
  1. function umf_template_override( $template, $template_name, $template_path ) { 
  2. $_template = $template; 
  3. if ( ! $template_path ) $template_path = $woocommerce->template_url; 
  4. $plugin_path = umf_path() . '/templates/'; 
  5. $template = locate_template( 
  6. array($template_path . $template_name, $template_name)); 
  7. if ( ! $template && file_exists( $plugin_path . $template_name ) ) 
  8. $template = $plugin_path . $template_name; 
  9. if ( ! $template ) 
  10. $template = $_template; 
  11. return $template;