/woocommerce-load-template.php Secret
Created
July 24, 2015 05:05
WooCommerce load template file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get template. | |
* | |
* Search for the template and include the file. | |
* | |
* @since 1.0.0 | |
* | |
* @see wcpt_locate_template() | |
* | |
* @param string $template_name Template to load. | |
* @param array $args Args passed for the template file. | |
* @param string $string $template_path Path to templates. | |
* @param string $default_path Default path to template files. | |
*/ | |
function wcpt_get_template( $template_name, $args = array(), $tempate_path = '', $default_path = '' ) { | |
if ( is_array( $args ) && isset( $args ) ) : | |
extract( $args ); | |
endif; | |
$template_file = wcpt_locate_template( $template_name, $tempate_path, $default_path ); | |
if ( ! file_exists( $template_file ) ) : | |
_doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $template_file ), '1.0.0' ); | |
return; | |
endif; | |
include $template_file; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the parameter, there is mistake in parameter name. It is $tempate_path instead of $template_path.