pods_template_part

Scope variables and include a template like get_template_part that's child-theme aware.

Description

(string|null) pods_template_part( (string|array) $template, (constant) $data = null, (bool) $return = false ); 

Returns (string|null)

Template output

Parameters (3)

0. $template (string|array)
Template names (see get_template_part)
1. $data — Optional. (constant) => null
Data to scope to the include
2. $return — Optional. (bool) => false
Whether to return the output (echo by default)

Usage

  1. if ( !function_exists( 'pods_template_part' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/general.php'; 
  3.  
  4. // Template names (see get_template_part) 
  5. $template = null; 
  6.  
  7. // Data to scope to the include 
  8. $data = null; 
  9.  
  10. // Whether to return the output (echo by default) 
  11. $return = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = pods_template_part($template, $data, $return); 
  15.  

Defined (1)

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

/includes/general.php  
  1. function pods_template_part ( $template, $data = null, $return = false ) { 
  2. $part = PodsView::get_template_part( $template, $data ); 
  3.  
  4. if ( !$return ) { 
  5. echo $part; 
  6.  
  7. return null; 
  8.  
  9. return $part;