locate_epm_template

Locate a template and return the path for inclusion.

Description

(string) locate_epm_template( (string) $template_name, (string) $template_path = '', (string) $default_path = '' ); 

This is the load order:

yourtheme / $template_path / $template_name yourtheme / $template_name $default_path / $template_name

Returns (string)

Parameters (3)

0. $template_name (string)
The template name.
1. $template_path — Optional. (string) => ''
The template path.
2. $default_path — Optional. (string) => ''
The default path.

Usage

  1. if ( !function_exists( 'locate_epm_template' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-peasy-mailchimp-ajax-form/includes/template.php'; 
  3.  
  4. // The template name. 
  5. $template_name = ''; 
  6.  
  7. // The template path. 
  8. $template_path = ''; 
  9.  
  10. // The default path. 
  11. $default_path = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = locate_epm_template($template_name, $template_path, $default_path); 
  15.  

Defined (1)

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

/includes/template.php  
  1. function locate_epm_template( $template_name, $template_path = '', $default_path = '' ) { 
  2. if ( ! $template_path ) 
  3. $template_path = 'epm'; 
  4. if ( ! $default_path ) 
  5. $default_path = EPM_PLUGIN_DIR . '/templates/'; 
  6.  
  7. // Look within passed path within the theme - this is priority 
  8. $template = locate_template( 
  9. array( 
  10. trailingslashit( $template_path ) . $template_name,  
  11. $template_name 
  12. ); 
  13.  
  14. // Get default template 
  15. if ( ! $template ) 
  16. $template = $default_path . $template_name; 
  17.  
  18. // Return what we found 
  19. return apply_filters( 'epm_locate_template', $template, $template_name, $template_path );