本文整理匯總了PHP中is_product_taxonomy函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_product_taxonomy函數的具體用法?PHP is_product_taxonomy怎麽用?PHP is_product_taxonomy使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_product_taxonomy函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
}
示例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;
}
示例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;
}
示例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 <andrea.grillo@yithemes.com>
*/
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');
}
}
示例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'));
}
}
示例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;
}
示例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'));
}
}
示例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);
}
示例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>');
示例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')) {
示例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 -->
示例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;
}
示例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;
}
示例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'];
}
示例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;
}
}