本文整理汇总了PHP中is_product_taxonomy函数的典型用法代码示例。如果您正苦于以下问题:PHP is_product_taxonomy函数的具体用法?PHP is_product_taxonomy怎么用?PHP is_product_taxonomy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_product_taxonomy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setup_gridlist
function setup_gridlist()
{
if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
add_action('wp_enqueue_scripts', array($this, 'setup_scripts_script'), 20);
add_action('woocommerce_before_shop_loop', array($this, 'gridlist_toggle_button'), 10);
}
}
开发者ID:ericsoncardosoweb,项目名称:dallia,代码行数:7,代码来源:grid_list_toggle.php
示例2: wolf_get_header_post_id
/**
* Get the post id to use to display a header
* For example, if a header is set for the blog, we will use it for the archive and search page
*
* @return int $id
*/
function wolf_get_header_post_id()
{
if (is_404() || is_page_template('page-templates/home.php')) {
return;
}
$post_id = null;
$shop_page_id = wolf_get_woocommerce_shop_page_id();
$is_shop_page = function_exists('is_shop') ? is_shop() : false;
$is_product_taxonomy = function_exists('is_product_taxonomy') ? is_product_taxonomy() : false;
$is_single_product = function_exists('is_product') ? is_product() : false;
// is blog
if (get_option('page_for_posts') && wolf_is_blog() && false == $is_shop_page && false == $is_product_taxonomy) {
$post_id = get_option('page_for_posts');
// if woocommerce
} elseif ($is_shop_page || $is_product_taxonomy) {
$post_id = $shop_page_id;
// is single product
} elseif ($is_single_product) {
if (get_post_meta(get_the_ID(), '_header_bg_img', true) || get_post_meta(get_the_ID(), '_header_bg_color', true)) {
$post_id = get_the_ID();
} else {
$post_id = $shop_page_id;
}
} else {
$post_id = get_the_ID();
}
return $post_id;
}
开发者ID:estrategasdigitales,项目名称:dictobas,代码行数:34,代码来源:single-post-options-css.php
示例3: template_loader
/**
* Load a template.
*
* Handles template usage so that we can use our own templates instead of the themes.
*
* Templates are in the 'templates' folder. woocommerce looks for theme
* overrides in /theme/woocommerce/ by default
*
* For beginners, it also looks for a woocommerce.php template first. If the user adds
* this to the theme (containing a woocommerce() inside) this will be used for all
* woocommerce templates.
*
* @param mixed $template
* @return string
*/
public static function template_loader($template)
{
$find = array('woocommerce.php');
$file = '';
if (is_single() && get_post_type() == 'product') {
$file = 'single-product.php';
$find[] = $file;
$find[] = WC()->template_path() . $file;
} elseif (is_product_taxonomy()) {
$term = get_queried_object();
if (is_tax('product_cat') || is_tax('product_tag')) {
$file = 'taxonomy-' . $term->taxonomy . '.php';
} else {
$file = 'archive-product.php';
}
$find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
$find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
$find[] = 'taxonomy-' . $term->taxonomy . '.php';
$find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '.php';
$find[] = $file;
$find[] = WC()->template_path() . $file;
} elseif (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) {
$file = 'archive-product.php';
$find[] = $file;
$find[] = WC()->template_path() . $file;
}
if ($file) {
$template = locate_template(array_unique($find));
$status_options = get_option('woocommerce_status_options', array());
if (!$template || !empty($status_options['template_debug_mode']) && current_user_can('manage_options')) {
$template = WC()->plugin_path() . '/templates/' . $file;
}
}
return $template;
}
开发者ID:uwitec,项目名称:findgreatmaster,代码行数:50,代码来源:class-wc-template-loader.php
示例4: widget
/**
* Echo the widget content.
*
* Subclasses should over-ride this function to generate their widget code.
*
* @param array $args Display arguments including before_title, after_title,
* before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget.
*
* @author Andrea Grillo <[email protected]>
*/
public function widget($args, $instance)
{
$hide = !empty($instance['hide_on_vendor_page']) && is_product_taxonomy(YITH_Vendors()->get_taxonomy_name());
if (!$hide) {
yith_wcpv_get_template('vendors-list', $instance, 'widgets');
}
}
开发者ID:yarwalker,项目名称:ecobyt,代码行数:18,代码来源:class.yith-woocommerce-vendors-widget.php
示例5: setup_scripts_script
function setup_scripts_script()
{
if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
wp_enqueue_script('cookie', plugins_url('/assets/js/jquery.cookie.min.js', __FILE__), array('jquery'));
wp_enqueue_script('grid-list-scripts', plugins_url('/assets/js/jquery.gridlistview.min.js', __FILE__), array('jquery'));
add_action('wp_footer', array(&$this, 'gridlist_set_default_view'));
}
}
开发者ID:abcode619,项目名称:wpstuff,代码行数:8,代码来源:grid-list-toggle.php
示例6: constructent_body_class
/**
* Add classes to <body>
*
* @param array $classes
*
* @return array
*/
function constructent_body_class($classes)
{
// Layout class
$classes[] = constructent_layout();
// Class for layout style
$classes[] = constructent_option('layout_style');
// Color scheme
$custom_color_scheme = constructent_option('custom_color_scheme');
if (!$custom_color_scheme) {
$classes[] = constructent_option('color_scheme');
} else {
$classes[] = 'custom-color-scheme';
}
// Class for custom header color
if (constructent_option('header_custom') && constructent_option('header_background')) {
$classes[] = 'header-custom';
}
// Class for woocommerce columns
if (function_exists('is_shop') && (is_shop() || is_product_taxonomy())) {
global $woocommerce_loop;
if (empty($woocommerce_loop['columns'])) {
$columns = 'full-content' == constructent_layout() ? 4 : 3;
} else {
$columns = $woocommerce_loop['columns'];
}
$classes[] = 'columns-' . esc_attr($columns);
}
// Class for solid header
$header_type = constructent_option('header_type');
$header_type = $header_type ? esc_attr($header_type) : 'static';
if ($header_type == 'absolute' && !is_page_template('tpl/homepage.php')) {
$classes[] = 'header-static';
} else {
$classes[] = 'header-' . $header_type;
}
// Transparent header
if ('absolute' == $header_type && is_page_template('tpl/homepage.php') && constructent_option('header_transparent')) {
$classes[] = 'header-transparent';
}
// Class for menu hover
if ($hover = constructent_option('menu_hover')) {
$classes[] = 'menu-hover-' . $hover;
}
// If no featured title area
if (!constructent_show_featured_title()) {
$classes[] = 'no-title-area';
}
// Class for portfolio layout
if (is_page_template('tpl/portfolio.php')) {
$classes[] = 'portfolio-' . constructent_meta('style_portfolio');
}
// Class for portfolio category layout
if (is_tax('portfolio_category')) {
$classes[] = 'portfolio-' . constructent_option('portfolio_view');
}
$classes = array_unique(array_filter($classes));
return $classes;
}
开发者ID:GTACSolutions,项目名称:Telios,代码行数:65,代码来源:frontend.php
示例7: setup_gridlist
function setup_gridlist()
{
if (is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy()) {
add_action('wp_enqueue_scripts', array($this, 'setup_scripts_styles'), 20);
add_action('wp_enqueue_scripts', array($this, 'setup_scripts_script'), 20);
add_action('woocommerce_before_shop_loop', array($this, 'gridlist_toggle_button'), 30);
add_action('woocommerce_after_shop_loop_item', array($this, 'gridlist_buttonwrap_open'), 9);
add_action('woocommerce_after_shop_loop_item', array($this, 'gridlist_buttonwrap_close'), 11);
add_action('woocommerce_after_shop_loop_item', array($this, 'gridlist_hr'), 30);
add_action('woocommerce_after_shop_loop_item', 'woocommerce_template_single_excerpt', 5);
add_action('woocommerce_after_subcategory', array($this, 'gridlist_cat_desc'));
}
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:13,代码来源:woocommerce-grid-list-toggle.php
示例8: init
public function init()
{
wp_localize_script('etp-script', 'sfpSettings', array('shopLayout' => false, 'mobStore' => false, 'infiniteScroll' => false));
if (!is_woocommerce_activated()) {
$this->css .= '.wc-18-tags-active #site-navigation > div { width: 100%; }';
return;
}
add_filter('eighteen_tags_loop_columns', array($this, 'columns'), 999);
//Header cart display
$header_cart = $this->get('header-wc-cart');
add_action('wc_18_tags_in' . $header_cart . '_nav', 'eighteen_tags_header_cart');
if (!empty($header_cart)) {
add_action('wc_18_tags_in_nav', 'eighteen_tags_header_cart');
WooCommerce_18_Tags_Public::$desktop_css .= '#site-navigation.main-navigation .site-header-cart { display: none !important; }';
$this->css .= '.wc-18-tags-active #site-navigation > div { width: 100%; }';
}
//Header cart color
$this->css .= '.wc-18-tags-active .site-header-cart .cart-contents { color: ' . $this->get('header-wc-cart-color', '#000000') . '; }';
$is_product_archive = is_shop() || is_product_taxonomy();
$is_checkout_process = is_cart() || is_checkout();
$this->set_styles($is_product_archive, $is_checkout_process);
}
开发者ID:pootlepress,项目名称:18tags-wc-add-on,代码行数:22,代码来源:class-woocommerce.php
示例9: printf
<?php
/**
* Template for displaying shop results bar/button
*/
if (!defined('ABSPATH')) {
exit;
}
// Is search query set and not empty?
$is_search = !empty($_REQUEST['s']) ? true : false;
if ($is_search || is_product_taxonomy()) {
// Is this a product category?
$is_category = $is_search ? false : is_product_category();
// Results bar class
$results_bar_class = $is_category ? ' is-category' : '';
// Get shop page URL
$shop_page_url = get_permalink(wc_get_page_id('shop'));
?>
<div class="nm-shop-results-bar btn<?php
echo esc_attr($results_bar_class);
?>
">
<a href="#" data-shop-url="<?php
echo esc_url($shop_page_url);
?>
" id="nm-shop-results-reset">
<i class="nm-font nm-font-close2"></i>
<?php
if ($is_search) {
printf(esc_html__('Search results for %s', 'nm-framework'), '<span>"' . $_REQUEST['s'] . '"</span>');
开发者ID:kevinotsuka,项目名称:coffeecircle,代码行数:31,代码来源:content-product_nm_results_bar.php
示例10: switch
switch ($headline) {
case 'mixed':
$headline = is_single() ? 'navigation' : 'breadcrumbs';
break;
case 'navigation':
if (!is_single()) {
$headline = 'none';
}
break;
}
if ($headline != 'none') {
get_template_part('parts/' . $headline);
}
?>
<h1><?php
if (Everything::isPluginActive('woocommerce') && (is_shop() || is_product_taxonomy()) && !is_product()) {
woocommerce_page_title();
} else {
if (is_home()) {
is_front_page() ? _e('Blog', 'everything') : single_post_title();
} else {
if (is_day()) {
echo get_the_date();
} else {
if (is_month()) {
echo get_the_date('F Y');
} else {
if (is_year()) {
echo get_the_date('Y');
} else {
if (is_category() || is_tax('portfolio-category')) {
开发者ID:xpander54,项目名称:wp-drz,代码行数:31,代码来源:headline.php
示例11: wp_reset_query
<?php
}
}
}
wp_reset_query();
}
}
?>
</h1>
<?php
if (of_get_option('g_breadcrumbs_id') == 'yes') {
?>
<!-- BEGIN BREADCRUMBS-->
<?php
/* Begin shop */
if (function_exists('is_shop') && is_shop() || function_exists('is_product') && is_product() || function_exists('is_product_taxonomy') && is_product_taxonomy() || function_exists('is_product_list') && is_product_list()) {
if (class_exists('Woocommerce')) {
woocommerce_breadcrumb(array('delimiter' => ' / ', 'wrap_before' => '<ul class="breadcrumb breadcrumb__t">', 'wrap_after' => '</ul>'));
} elseif (function_exists('jigoshop_init')) {
jigoshop_breadcrumb('/ ', '<ul class="breadcrumb breadcrumb__t">', '</ul>');
}
/* End shop */
} elseif (function_exists('breadcrumbs')) {
breadcrumbs();
}
?>
<!-- END BREADCRUMBS -->
<?php
}
?>
</section><!-- .title-section -->
开发者ID:pearlohuy,项目名称:megashop,代码行数:31,代码来源:title.php
示例12: woocommerce_products_will_display
/**
* Check if we will be showing products or not (and not subcats only)
*
* @access public
* @subpackage Loop
* @return bool
*/
function woocommerce_products_will_display()
{
if (is_shop()) {
return get_option('woocommerce_shop_page_display') != 'subcategories';
}
if (!is_product_taxonomy()) {
return false;
}
if (is_search() || is_filtered() || is_paged()) {
return true;
}
$term = get_queried_object();
if (is_product_category()) {
switch (get_woocommerce_term_meta($term->term_id, 'display_type', true)) {
case 'products':
case 'both':
return true;
break;
case '':
if (get_option('woocommerce_category_archive_display') != 'subcategories') {
return true;
}
break;
}
}
global $wpdb;
$parent_id = empty($term->term_id) ? 0 : $term->term_id;
$taxonomy = empty($term->taxonomy) ? '' : $term->taxonomy;
$products_will_display = false;
if (!$parent_id && !$taxonomy) {
return true;
}
if (false === ($products_will_display = get_transient('wc_products_will_display_' . $parent_id))) {
$has_children = $wpdb->get_col($wpdb->prepare("SELECT term_id FROM {$wpdb->term_taxonomy} WHERE parent = %d AND taxonomy = %s", $parent_id, $taxonomy));
if ($has_children) {
// Check terms have products inside - parents first
if (sizeof(get_objects_in_term($has_children, $taxonomy)) > 0) {
$products_will_display = true;
} else {
// If we get here, the parents were empty so we're forced to check children
foreach ($has_children as $term) {
$children = get_term_children($term, $taxonomy);
if (sizeof(get_objects_in_term($children, $taxonomy)) > 0) {
$products_will_display = true;
break;
}
}
}
} else {
$products_will_display = true;
}
}
set_transient('wc_products_will_display_' . $parent_id, $products_will_display);
return $products_will_display;
}
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:62,代码来源:wc-template-functions.php
示例13: redirect_double_taxonomy
function redirect_double_taxonomy($redirect, $request)
{
if (self::$settings['permalink_structure'] !== '' && (is_shop() || is_product_taxonomy()) !== false && strpos($request, 'product_cat=') > 0) {
return $request;
}
return $redirect;
}
开发者ID:arobbins,项目名称:spellestate,代码行数:7,代码来源:prdctfltr.php
示例14: do_action
do_action('prdctfltr_filter_form_after', $curr_options, $pf_activated);
?>
<div class="prdctfltr_add_inputs">
<?php
if (!in_array('search', $curr_elements) && isset($pf_activated['s'])) {
echo '<input type="hidden" name="s" value="' . $pf_activated['s'] . '" />';
}
if (isset($_GET['page_id'])) {
echo '<input type="hidden" name="page_id" value="' . $_GET['page_id'] . '" />';
}
if (isset($_GET['lang'])) {
echo '<input type="hidden" name="lang" value="' . $_GET['lang'] . '" />';
}
$curr_posttype = get_option('wc_settings_prdctfltr_force_product', 'no');
if ($curr_posttype == 'no') {
if (!isset($pf_activated['s']) && $pf_structure == '' && (is_shop() || is_product_taxonomy())) {
echo '<input type="hidden" name="post_type" value="product" />';
}
} else {
echo '<input type="hidden" name="post_type" value="product" />';
}
if (isset($pf_activated['orderby']) && !in_array('sort', $curr_elements)) {
echo '<input type="hidden" name="orderby" value="' . $pf_activated['orderby'] . '" />';
}
if (!isset($prdctfltr_global['sc_init']) && !empty($prdctfltr_global['active_permalinks'])) {
foreach ($prdctfltr_global['active_permalinks'] as $pf_k => $pf_v) {
/*if ( !in_array( $pf_k, $active_filters ) ) {*/
echo '<input type="hidden" name="' . $pf_k . '" value="' . $prdctfltr_global['permalinks_data'][$pf_k . '_string'] . '" />';
/*}*/
$prdctfltr_global['filter_js'][$prdctfltr_id]['adds'][$pf_k] = $prdctfltr_global['permalinks_data'][$pf_k . '_string'];
}
开发者ID:arobbins,项目名称:spellestate,代码行数:31,代码来源:product-filter.php
示例15: woocommerce_products_will_display
/**
* Check if we will be showing products or not (and not subcats only)
*
* @access public
* @subpackage Loop
* @return void
*/
function woocommerce_products_will_display()
{
global $woocommerce, $wpdb;
if (!is_product_category() && !is_product_tag() && !is_shop() && !is_product_taxonomy()) {
return false;
}
if (is_search() || is_filtered() || is_paged()) {
return true;
}
if (is_shop() && get_option('woocommerce_shop_page_display') != 'subcategories') {
return true;
}
$term = get_queried_object();
if (is_product_category()) {
switch (get_woocommerce_term_meta($term->term_id, 'display_type', true)) {
case 'products':
case 'both':
return true;
break;
case '':
if (get_option('woocommerce_category_archive_display') != 'subcategories') {
return true;
}
break;
}
}
$parent_id = empty($term->term_id) ? 0 : $term->term_id;
$has_children = $wpdb->get_col($wpdb->prepare("SELECT term_id FROM {$wpdb->term_taxonomy} WHERE parent = %d", $parent_id));
if ($has_children) {
// Check terms have products inside
$children = array();
foreach ($has_children as $term) {
$children = array_merge($children, get_term_children($term, 'product_cat'));
$children[] = $term;
}
$objects = get_objects_in_term($children, 'product_cat');
if (sizeof($objects) > 0) {
return false;
} else {
return true;
}
} else {
return true;
}
}
开发者ID:GarryVeles,项目名称:Artibaltika,代码行数:52,代码来源:woocommerce-template.php
示例16: bbp_get_breadcrumb
<?php
/**
* @package WordPress
* @subpackage Everything
* @since 1.0
*/
// Separator
$separator = '›';
// is_rtl() ? '‹' : '›'
// bbPress
if (Everything::isPluginActive('bbpress') && Everything::to('bbpress/breadcrumbs') && is_bbpress()) {
$breadcrumbs_html = bbp_get_breadcrumb(array('before' => '', 'after' => '', 'sep' => $separator, 'sep_before' => '', 'sep_after' => '', 'current_before' => '', 'current_after' => ''));
} else {
if (Everything::isPluginActive('woocommerce') && Everything::to('woocommerce/breadcrumbs') && (is_shop() || is_product_taxonomy() || is_product())) {
// || is_cart() || is_checkout() || is_order_received_page() || is_account_page()
$breadcrumbs_html = \Drone\Func::functionGetOutputBuffer('woocommerce_breadcrumb', array('delimiter' => $separator, 'wrap_before' => '', 'wrap_after' => ''));
} else {
if (Everything::isPluginActive('breadcrumb-navxt')) {
$options = get_option('bcn_options');
$separator = $options['hseparator'];
$breadcrumbs_html = bcn_display(true);
} else {
if (Everything::isPluginActive('breadcrumb-trail')) {
$breadcrumbs_html = breadcrumb_trail(array('separator' => $separator, 'show_browse' => false, 'echo' => false));
} else {
if (Everything::isPluginActive('wordpress-seo')) {
$options = get_option('wpseo_internallinks');
$separator = $options['breadcrumbs-sep'] ? $options['breadcrumbs-sep'] : '»';
$breadcrumbs_html = yoast_breadcrumb('', '', false);
} else {
开发者ID:xpander54,项目名称:wp-drz,代码行数:31,代码来源:breadcrumbs.php
示例17: generate_product_data
/**
* Generates Product structured data.
*
* Hooked into `woocommerce_single_product_summary` action hook.
* Hooked into `woocommerce_shop_loop` action hook.
*
* @param WC_Product $product Product data (default: null).
*/
public function generate_product_data($product = null)
{
if (!is_object($product)) {
global $product;
}
$markup = array();
$markup['@type'] = 'Product';
$markup['@id'] = get_permalink($product->get_id());
$markup['url'] = $markup['@id'];
$markup['name'] = $product->get_title();
if (apply_filters('woocommerce_structured_data_product_limit', is_product_taxonomy() || is_shop())) {
$this->set_data(apply_filters('woocommerce_structured_data_product_limited', $markup, $product));
return;
}
$products = array();
if ($is_variable = $product->is_type('variable')) {
$variations = $product->get_available_variations();
foreach ($variations as $variation) {
$products[] = wc_get_product($variation['variation_id']);
}
} else {
$products[] = $product;
}
$markup_offers = array();
foreach ($products as $_product) {
$markup_offers[] = array('@type' => 'Offer', 'priceCurrency' => get_woocommerce_currency(), 'price' => $_product->get_price(), 'availability' => 'http://schema.org/' . ($stock = $_product->is_in_stock() ? 'InStock' : 'OutOfStock'), 'sku' => $_product->get_sku(), 'image' => wp_get_attachment_url($_product->get_image_id()), 'description' => $is_variable ? $_product->get_variation_description() : '', 'seller' => array('@type' => 'Organization', 'name' => get_bloginfo('name'), 'url' => get_bloginfo('url')));
}
$markup['description'] = get_the_excerpt($product->get_id());
$markup['offers'] = $markup_offers;
if ($product->get_rating_count()) {
$markup['aggregateRating'] = array('@type' => 'AggregateRating', 'ratingValue' => $product->get_average_rating(), 'ratingCount' => $product->get_rating_count(), 'reviewCount' => $product->get_review_count());
}
$this->set_data(apply_filters('woocommerce_structured_data_product', $markup, $product));
}
开发者ID:johnulist,项目名称:woocommerce,代码行数:42,代码来源:class-wc-structured-data.php
示例18: woocommerce_before_shop_loop
public static function woocommerce_before_shop_loop()
{
if (!defined('DOING_AJAX')) {
if (is_product_taxonomy() or is_shop()) {
if (class_exists('MetaDataFilter') and MetaDataFilter::is_page_mdf_data()) {
$_REQUEST['mdf_do_not_render_shortcode_tpl'] = true;
$_REQUEST['mdf_get_query_args_only'] = true;
do_shortcode('[meta_data_filter_results]');
$args = $_REQUEST['meta_data_filter_args'];
global $wp_query;
$wp_query = new WP_Query($args);
$_REQUEST['meta_data_filter_found_posts'] = $wp_query->found_posts;
}
}
}
}
开发者ID:Lumbe,项目名称:dev_servus,代码行数:16,代码来源:index.php
示例19: shop_page_layouts
/**
* Get specific layouts from options for shop-related pages
*
* @since 1.0.0
* @param string $layout layout type.
* @return string
*/
public function shop_page_layouts($layout)
{
if (is_shop()) {
$layout = cherry_wc_options()->get_option('shop-loop-layout', 'no-sidebar');
} elseif (is_product_taxonomy()) {
$layout = cherry_wc_options()->get_option('shop-category-layout', 'no-sidebar');
} elseif (is_singular('product')) {
$layout = cherry_wc_options()->get_option('shop-single-layout', 'no-sidebar');
}
return $layout;
}
开发者ID:pixelTM,项目名称:cherry-woocommerce-package,代码行数:18,代码来源:class-cherry-wc-frontend-hooks.php
示例20: template_loader
function template_loader($template)
{
if (is_product_taxonomy()) {
global $sitepress, $woocommerce_wpml;
$current_language = $sitepress->get_current_language();
$default_language = $sitepress->get_default_language();
if ($current_language != $default_language) {
$templates = array('woocommerce.php');
$term = get_queried_object();
if (is_tax('product_cat') || is_tax('product_tag')) {
$file = 'taxonomy-' . $term->taxonomy . '.php';
} else {
$file = 'archive-product.php';
}
// check templates
$term = get_queried_object();
$taxonomy = $term->taxonomy;
$prefix = 'taxonomy-' . $taxonomy;
$original_term_id = icl_object_id($term->term_id, $taxonomy, true, $default_language);
$original_term = $woocommerce_wpml->products->wcml_get_term_by_id($original_term_id, $taxonomy);
$terms_to_check = array($term->term_id => $term->slug);
if ($original_term) {
$terms_to_check[$original_term_id] = $original_term->slug;
}
$paths = array('', WC()->template_path());
foreach ($paths as $path) {
foreach ($terms_to_check as $term_id => $term_slug) {
$templates[] = $path . "{$prefix}-{$current_language}-{$term_slug}.php";
$templates[] = $path . "{$prefix}-{$current_language}-{$term_id}.php";
$templates[] = $path . "{$prefix}-{$term_slug}.php";
$templates[] = $path . "{$prefix}-{$term_id}.php";
}
$templates[] = $path . "{$prefix}-{$current_language}.php";
$templates[] = $path . "{$prefix}.php";
$templates[] = $path . $file;
}
$template = locate_template(array_unique($templates));
if (!$template || WC_TEMPLATE_DEBUG_MODE) {
$template = WC()->plugin_path() . '/templates/' . $file;
}
}
}
return $template;
}
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:44,代码来源:store-pages.class.php
注:本文中的is_product_taxonomy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论