تابع ووکامرسی wc_locate_template فرخوانی فایل php و برگرداندن مسیر آن

تابع ووکامرسی wc_locate_template – فرخوانی فایل php و برگرداندن مسیر آن
Syntax – سینتکس
(string) wc_locate_template( (string) $template_name, (string) $template_path = '', (string) $default_path = '' );
Parameters – پارامتر ها (3)
- 1- $template_name (string)
- 2- $template_path (string)
- 3- $default_path (string)
Usage – نحوه استفاده
if ( !function_exists( 'wc_locate_template' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php';
}
// The template name.
$template_name = '';
// The template path.
$template_path = '';
// The default path.
$default_path = '';
// NOTICE! Understand what this does before running.
$result = wc_locate_template($template_name, $template_path, $default_path);
Defined – محل تعریف
/includes/wc-core-functions.php
function wc_locate_template( $template_name, $template_path = '', $default_path = '' ) {
if ( ! $template_path ) {
$template_path = WC()->template_path();
}
if ( ! $default_path ) {
$default_path = WC()->plugin_path() . '/templates/';
}
// Look within passed path within the theme - this is priority.
$template = locate_template(
array(
trailingslashit( $template_path ) . $template_name,
$template_name,
)
);
// Get default template/
if ( ! $template || WC_TEMPLATE_DEBUG_MODE ) {
$template = $default_path . $template_name;
}
// Return what we found.
return apply_filters( 'woocommerce_locate_template', $template, $template_name, $template_path );
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر