get_epm_template_part

Get template part (for templates in loops).

Description

get_epm_template_part( (mixed) $slug, (string) $name = '' ); 

Parameters (2)

0. $slug (mixed)
The slug.
1. $name — Optional. (string) => ''
(default: '')

Usage

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

Defined (1)

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

/includes/template.php  
  1. function get_epm_template_part( $slug, $name = '' ) { 
  2. $template = ''; 
  3.  
  4. // Look in yourtheme/slug-name.php and yourtheme/epm/slug-name.php 
  5. if ( $name ) 
  6. $template = locate_template( array ( "{$slug}-{$name}.php", "epm/{$slug}-{$name}.php" ) ); 
  7.  
  8. // Get default slug-name.php 
  9. if ( ! $template && $name && file_exists( EPM_PLUGIN_DIR . "/templates/{$slug}-{$name}.php" ) ) 
  10. $template = EPM_PLUGIN_DIR . "/templates/{$slug}-{$name}.php"; 
  11.  
  12. // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/epm/slug.php 
  13. if ( ! $template ) 
  14. $template = locate_template( array ( "{$slug}.php", "epm/{$slug}.php" ) ); 
  15.  
  16. if ( $template ) 
  17. load_template( $template, false );