wc_get_template_html

Like wc_get_template, but returns the HTML instead of outputting.

Description

wc_get_template_html( (string) $template_name, (array) $args = array(), (string) $template_path = '', (string) $default_path = '' ); 

Parameters (4)

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

Usage

  1. if ( !function_exists( 'wc_get_template_html' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4. // The template name. 
  5. $template_name = ''; 
  6.  
  7. // The args. 
  8. $args = array(); 
  9.  
  10. // The template path. 
  11. $template_path = ''; 
  12.  
  13. // The default path. 
  14. $default_path = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = wc_get_template_html($template_name, $args, $template_path, $default_path); 
  18.  

Defined (1)

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

/includes/wc-core-functions.php  
  1. function wc_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) { 
  2. ob_start(); 
  3. wc_get_template( $template_name, $args, $template_path, $default_path ); 
  4. return ob_get_clean();