wc_ps_get_template_file_path

Wc_ps_get_template_file_path( $file ).

Description

wc_ps_get_template_file_path( (string) $file = '' ); 

This is the load order:

yourtheme / woocommerce / $file yourtheme / $file WOOPS_TEMPLATE_PATH / $file

Parameters (1)

0. $file — Optional. (string) => ''
String filename

Usage

  1. if ( !function_exists( 'wc_ps_get_template_file_path' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-predictive-search-lite/includes/wc-predictive-template-functions.php'; 
  3.  
  4. // string filename 
  5. $file = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_ps_get_template_file_path($file); 
  9.  

Defined (1)

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

/includes/wc-predictive-template-functions.php  
  1. function wc_ps_get_template_file_path( $file = '' ) { 
  2. // If we're not looking for a file, do not proceed 
  3. if ( empty( $file ) ) 
  4. return; 
  5.  
  6. // Look for file in stylesheet 
  7. if ( file_exists( get_stylesheet_directory() . '/woocommerce/' . $file ) ) { 
  8. $file_path = get_stylesheet_directory() . '/woocommerce/' . $file; 
  9.  
  10. // Look for file in stylesheet 
  11. } elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) { 
  12. $file_path = get_stylesheet_directory() . '/' . $file; 
  13.  
  14. // Look for file in template 
  15. } elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) { 
  16. $file_path = get_template_directory() . '/woocommerce/' . $file; 
  17.  
  18. // Look for file in template 
  19. } elseif ( file_exists( get_template_directory() . '/' . $file ) ) { 
  20. $file_path = get_template_directory() . '/' . $file; 
  21.  
  22. // Get default template 
  23. } else { 
  24. $file_path = WOOPS_TEMPLATE_PATH . '/' . $file; 
  25.  
  26. // Return filtered result 
  27. return apply_filters( 'wc_ps_get_template_file_path', $file_path, $file );