yit_plugin_locate_template

Locate the templates and return the path of the file found.

Description

(string) yit_plugin_locate_template( (string) $plugin_basename, (string) $path, (null) $var = null ); 

Returns (string)

Parameters (3)

0. $plugin_basename (string)
The plugin basename.
1. $path (string)
The path.
2. $var — Optional. (null) => null
The var.

Usage

  1. if ( !function_exists( 'yit_plugin_locate_template' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-compare/plugin-fw/yit-functions.php'; 
  3.  
  4. // The plugin basename. 
  5. $plugin_basename = ''; 
  6.  
  7. // The path. 
  8. $path = ''; 
  9.  
  10. // The var. 
  11. $var = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = yit_plugin_locate_template($plugin_basename, $path, $var); 
  15.  

Defined (1)

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

/plugin-fw/yit-functions.php  
  1. function yit_plugin_locate_template ( $plugin_basename, $path, $var = NULL ) { 
  2.  
  3. $template_path = '/theme/templates/' . $path; 
  4.  
  5. $located = locate_template ( array ( 
  6. $template_path,  
  7. ) ); 
  8.  
  9. if ( ! $located ) { 
  10. $located = $plugin_basename . '/templates/' . $path; 
  11.  
  12. return $located;