本文整理汇总了PHP中wc_locate_template函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_locate_template函数的具体用法?PHP wc_locate_template怎么用?PHP wc_locate_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_locate_template函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: add_view_subscription_template
/**
* Show the subscription template when view a subscription instead of loading the default order template.
*
* @param $located
* @param $template_name
* @param $args
* @param $template_path
* @param $default_path
* @since 2.0
*/
public static function add_view_subscription_template($located, $template_name, $args, $template_path, $default_path)
{
global $wp;
if ('myaccount/my-account.php' == $template_name && !empty($wp->query_vars['view-subscription']) && WC_Subscriptions::is_woocommerce_pre('2.6')) {
$located = wc_locate_template('myaccount/view-subscription.php', $template_path, plugin_dir_path(WC_Subscriptions::$plugin_file) . 'templates/');
}
return $located;
}
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:18,代码来源:class-wcs-template-loader.php
示例2: yith_wcpv_get_template
/**
* Get Plugin Template
*
* It's possible to overwrite the template from theme.
* Put your custom template in woocommerce/product-vendors folder
*
* @param $filename
* @param array $args
* @param string $section
* @use wc_get_template()
* @since 1.0
* @return void
*/
function yith_wcpv_get_template($filename, $args = array(), $section = '')
{
$ext = strpos($filename, '.php') === false ? '.php' : '';
$template_name = $section . '/' . $filename . $ext;
$template_path = WC()->template_path() . 'product-vendors/';
$default_path = YITH_WPV_TEMPLATE_PATH;
if (defined('YITH_WPV_PREMIUM')) {
$premium_template = str_replace('.php', '-premium.php', $template_name);
$located_premium = wc_locate_template($premium_template, $template_path, $default_path);
$template_name = file_exists($located_premium) ? $premium_template : $template_name;
}
wc_get_template($template_name, $args, $template_path, $default_path);
}
开发者ID:tib07,项目名称:yith-woocommerce-product-vendors,代码行数:26,代码来源:functions.yith-vendors.php
示例3: yith_wcbr_get_template
/**
* Get template for Brands plugin
*
* @param $filename string Template name (with or without extension)
* @param $args mixed Array of params to use in the template
* @param $section string Subdirectory where to search
*/
function yith_wcbr_get_template($filename, $args = array(), $section = '')
{
$ext = strpos($filename, '.php') === false ? '.php' : '';
$template_name = $section . '/' . $filename . $ext;
$template_path = WC()->template_path() . 'yith-wcbr/';
$default_path = YITH_WCBR_DIR . 'templates/';
if (defined('YITH_WCBR_PREMIUM')) {
$premium_template = str_replace('.php', '-premium.php', $template_name);
$located_premium = wc_locate_template($premium_template, $template_path, $default_path);
$template_name = file_exists($located_premium) ? $premium_template : $template_name;
}
wc_get_template($template_name, $args, $template_path, $default_path);
}
开发者ID:k2jysy,项目名称:mergeshop,代码行数:20,代码来源:functions.yith-wcbr.php
示例4: add_skip_subscription_template
/**
* Show the cancel and skip subscription template when the cancel action has been pressed.
* Show a confirmation template when the customer decides to cancel the subscription.
* Show a succesfull skipped subscription template when the customer decides to skip a subscription.
* Show a succesfull unskipped subscription template when the customer decides to unskip a subscription.
*
* @since 1.0.0
* @access public
* @static
* @param $located
* @param $template_name
* @param $args
* @param $template_path
* @param $default_path
*/
public static function add_skip_subscription_template($located, $template_name, $args, $template_path, $default_path)
{
global $wp;
if ('myaccount/my-account.php' == $template_name && !empty($wp->query_vars['cancel-subscription'])) {
$located = wc_locate_template('myaccount/cancel-subscription.php', $template_path, WCSO_PLUGIN_DIR . '/templates/');
}
if ('myaccount/my-account.php' == $template_name && !empty($wp->query_vars['confirm-cancel'])) {
$located = wc_locate_template('myaccount/confirm-cancel.php', $template_path, WCSO_PLUGIN_DIR . '/templates/');
}
if ('myaccount/my-account.php' == $template_name && !empty($wp->query_vars['subscription-skipped'])) {
$located = wc_locate_template('myaccount/subscription-successfully-skipped.php', $template_path, WCSO_PLUGIN_DIR . '/templates/');
}
if ('myaccount/my-account.php' == $template_name && !empty($wp->query_vars['subscription-unskipped'])) {
$located = wc_locate_template('myaccount/subscription-unskipped.php', $template_path, WCSO_PLUGIN_DIR . '/templates/');
}
return $located;
}
开发者ID:AnimalsCode,项目名称:WooCommerce-Skip-One,代码行数:32,代码来源:class-wcso-display.php
示例5: wc_get_template
/**
* Get other templates (e.g. product attributes) passing attributes and including the file.
*
* @access public
* @param string $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
*/
function wc_get_template($template_name, $args = array(), $template_path = '', $default_path = '')
{
if ($args && is_array($args)) {
extract($args);
}
$located = wc_locate_template($template_name, $template_path, $default_path);
if (!file_exists($located)) {
_doing_it_wrong(__FUNCTION__, sprintf('<code>%s</code> does not exist.', $located), '2.1');
return;
}
// Allow 3rd party plugin filter template file from their plugin
$located = apply_filters('wc_get_template', $located, $template_name, $args, $template_path, $default_path);
do_action('woocommerce_before_template_part', $template_name, $template_path, $located, $args);
include $located;
do_action('woocommerce_after_template_part', $template_name, $template_path, $located, $args);
}
开发者ID:slavic18,项目名称:cats,代码行数:25,代码来源:wc-core-functions.php
示例6: woocommerce_locate_template
/**
* @deprecated
*/
function woocommerce_locate_template($template_name, $template_path = '', $default_path = '')
{
return wc_locate_template($template_name, $template_path, $default_path);
}
开发者ID:nayemDevs,项目名称:woocommerce,代码行数:7,代码来源:wc-deprecated-functions.php
示例7: hide_single_add_to_cart
/**
* Change single add to cart template
*
* @param $located
* @param $template_name
* @param $args
* @param $template_path
* @param $default_path
*
* @return string Located file
*
* @since 1.7
* @author Andrea Grillo <[email protected]>
*/
public function hide_single_add_to_cart($located, $template_name, $args, $template_path, $default_path)
{
if (is_singular('product') && preg_match('/single-product\\/add-to-cart\\/(\\S+).php/', $template_name)) {
$vendor = yith_get_vendor('current', 'product');
if ($vendor->is_on_vacation()) {
if ('disabled' == $vendor->vacation_selling) {
$located = wc_locate_template('single-product/store-vacation.php', WC()->template_path(), YITH_WPV_TEMPLATE_PATH . '/woocommerce/');
} elseif ('enabled' == $vendor->vacation_selling) {
add_action('woocommerce_before_template_part', array($this, 'add_vacation_template'), 10, 4);
}
}
}
return $located;
}
开发者ID:shwetadubey,项目名称:upfit,代码行数:28,代码来源:module.yith-vendor-vacation.php
示例8: locate_template
public function locate_template($template)
{
$default_path = WC_QD_TEMPLATE;
$template_path = WC_CORE_TEMPLATE . 'donation/';
$template = $template;
$locate = wc_locate_template($template, $template_path, $default_path);
return $locate;
}
开发者ID:bestmazzo,项目名称:woocomerce-quick-donation,代码行数:8,代码来源:class-quick-donation-functions.php
示例9: wc_get_template
public function wc_get_template($located, $template_name, $args, $template_path, $default_path)
{
if ("single-product/rating.php" != $template_name) {
return $located;
}
$located = wc_locate_template("ywar-rating.php", $template_path, $default_path);
if (file_exists($located)) {
return $located;
}
return YITH_YWAR_TEMPLATES_DIR . 'ywar-rating.php';
}
开发者ID:allyeastman,项目名称:studio-sapphire,代码行数:11,代码来源:class.yith-woocommerce-advanced-reviews.php
示例10: get_text_data
public function get_text_data($mail)
{
if ($text_data = get_transient('woo_email_manager_text_' . $mail->id)) {
return $text_data;
}
$template = $mail->template_html;
if ($mail->get_option('type') === 'plain') {
$template = $mail->template_plain;
}
$template_file = wc_locate_template($template);
// Parse text in email
$file = fopen($template_file, 'r');
$content = '';
if ($file) {
$content = fread($file, filesize($template_file));
}
$gettexts = array();
if (!empty($content)) {
preg_match_all('/_(_|e|x)\\(.*,.?(\'|\\").*(\'|\\").?\\)/', $content, $matches);
if (!empty($matches[0])) {
foreach ($matches[0] as $string) {
$string = str_replace('"', "'", $string);
$items = explode("'", $string);
if (!isset($items[3])) {
continue;
}
$gettexts[] = array('text' => trim($items[1]), 'textdomain' => strpos($string, '_x') !== false && isset($items[5]) ? trim($items[5]) : trim($items[3]), 'specified' => strpos($string, '_x') !== false && isset($items[3]) ? $items[3] : false);
}
}
}
set_transient('woo_email_manager_text_' . $mail->id, $gettexts, WEEK_IN_SECONDS);
return $gettexts;
}
开发者ID:vendidero,项目名称:woo-email-manager,代码行数:33,代码来源:woo-email-manager.php
示例11: wc_get_template
/**
* Get other templates (e.g. product attributes) passing attributes and including the file.
*
* @access public
* @param mixed $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return void
*/
function wc_get_template($template_name, $args = array(), $template_path = '', $default_path = '')
{
if ($args && is_array($args)) {
extract($args);
}
$located = wc_locate_template($template_name, $template_path, $default_path);
do_action('woocommerce_before_template_part', $template_name, $template_path, $located, $args);
include $located;
do_action('woocommerce_after_template_part', $template_name, $template_path, $located, $args);
}
开发者ID:prosenjit-itobuz,项目名称:nutraperfect,代码行数:20,代码来源:wc-core-functions.php
示例12: get_template
public function get_template($located, $template_name, $args, $template_path, $default_path)
{
$file = '';
$order_id = 0;
$found = false;
if (isset($args['order_id'])) {
$order_id = $args['order_id'];
}
if (isset($args['order']->id)) {
$order_id = $args['order']->id;
}
if (isset(self::$search_template['general'][$template_name])) {
$file = WC_QD()->f()->locate_template(self::$search_template['general'][$template_name]);
$found = true;
}
if (WC_QD()->check_donation_exists_cart()) {
if (isset(self::$search_template['is_donation'][$template_name])) {
$file = WC_QD()->f()->locate_template(self::$search_template['is_donation'][$template_name]);
$found = true;
}
}
if (WC_QD()->db()->_is_donation($order_id)) {
if (isset(self::$search_template['after_order'][$template_name])) {
$file = WC_QD()->f()->locate_template(self::$search_template['after_order'][$template_name]);
$found = true;
}
}
if ($found) {
return $file;
} else {
$file = wc_locate_template($template_name);
return $file;
}
return $located;
}
开发者ID:Negative-Network,项目名称:woocommerce-quick-donation,代码行数:35,代码来源:class-quick-donation-functions.php
示例13: locate_email_template
/**
* Locate the template file for this email
*
* Looks for templates in the following order:
* 1. emails/{$type}-order-status-email-{$slug}.php
* 2. emails/{$type}-order-status-email-{$id}.php
* 3. emails/{$type}-order-status-email.php
*
* Templates are looked for in current theme, then our plugin and then WC core.
*
* @since 1.0.0
* @param string $type Optional. Type of template to locate. One of `html` or `plain`. Defaults to `html`
* @return string Path to template file
*/
public function locate_email_template($type = 'html')
{
$type_path = 'plain' == $type ? 'plain/' : '';
$templates = array("emails/{$type_path}{$this->type}-order-status-email-{$this->post_id}.php", "emails/{$type_path}{$this->type}-order-status-email.php");
if ($email_slug = sanitize_title($this->title)) {
array_unshift($templates, "emails/{$type_path}{$this->type}-order-status-email-{$email_slug}.php");
}
$located_template = '';
// Try to locate the template file, starting from most specific
foreach ($templates as $template_path) {
$located = wc_locate_template($template_path);
if ($located && file_exists($located)) {
$located_template = $template_path;
break;
}
}
return $located_template;
}
开发者ID:seoduda,项目名称:Patua,代码行数:32,代码来源:class-wc-order-status-manager-order-status-email.php
示例14: tm_wc_get_template
public function tm_wc_get_template($located = "", $template_name = "", $args = "", $template_path = "", $default_path = "")
{
$templates = array();
if ($this->tm_epo_cart_field_display == "advanced") {
$templates = array_merge($templates, array('cart/cart.php', 'checkout/review-order.php'));
}
if (in_array($template_name, $templates)) {
$_located = wc_locate_template($template_name, $this->template_path, $this->template_path);
if (file_exists($_located)) {
$located = $_located;
}
}
return $located;
}
开发者ID:baden03,项目名称:access48,代码行数:14,代码来源:class-tm-extra-product-options.php
注:本文中的wc_locate_template函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论