本文整理匯總了PHP中is_product_category函數的典型用法代碼示例。如果您正苦於以下問題:PHP is_product_category函數的具體用法?PHP is_product_category怎麽用?PHP is_product_category使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了is_product_category函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: wcva_register_shop_scripts
public function wcva_register_shop_scripts()
{
if (is_shop() || is_product_category() || is_product_tag()) {
wp_enqueue_script('wcva-shop-frontend', '' . wcva_PLUGIN_URL . 'js/shop-frontend.js', array('jquery'));
wp_enqueue_style('wcva-shop-frontend', '' . wcva_PLUGIN_URL . 'css/shop-frontend.css');
}
}
示例2: siw_remove_unnecessary_scripts
function siw_remove_unnecessary_scripts()
{
//variatie als radiobuttons
if (!is_product()) {
wp_dequeue_script('kt-wc-add-to-cart-variation-radio');
}
//woocommerce ajax filter
if (!is_shop() && !is_product_category() && !is_product_tag()) {
wp_dequeue_script('yith-wcan-script');
wp_dequeue_style('yith-wcan-frontend');
}
//woocommerce
wp_dequeue_script('woocommerce');
//wp-embed
wp_deregister_script('wp-embed');
//search&filter
wp_dequeue_style('search-filter-chosen-styles');
wp_dequeue_style('search-filter-plugin-styles');
wp_deregister_script('search-filter-chosen-script');
wp_deregister_script('jquery-ui-datepicker');
wp_deregister_script('search-filter-plugin-build');
wp_register_script('search-filter-plugin-build', plugins_url('search-filter-pro/public/assets/js/search-filter-build.min.js'), array('jquery'), '', TRUE);
//kadence slider wordt alleen gebruikt op de homepage.
if (!is_front_page()) {
wp_dequeue_script('kadence_slider_js');
wp_dequeue_style('kadence_slider_css');
}
//ncf font
wp_dequeue_style('ncf_lato_font');
//styling van mailpoet widget
wp_deregister_style('validate-engine-css');
}
示例3: tesseract_woocommerce_wrapper_start
function tesseract_woocommerce_wrapper_start()
{
$layout_loop = get_theme_mod('tesseract_woocommerce_loop_layout');
$layout_product = get_theme_mod('tesseract_woocommerce_product_layout');
if (is_shop() || is_product_category() || is_product_tag()) {
if ($layout_loop == 'sidebar-left' || $layout_loop == 'sidebar-right') {
$primclass = 'with-sidebar';
$primclass .= $layout_loop == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
} else {
if ($layout_loop == 'fullwidth' || !$layout_loop) {
$primclass = 'no-sidebar';
}
}
} else {
if (is_product()) {
if ($layout_product == 'sidebar-left' || $layout_product == 'sidebar-right') {
$primclass = 'with-sidebar';
$primclass .= $layout_product == 'sidebar-left' ? ' sidebar-left' : ' sidebar-right';
} else {
if ($layout_product == 'fullwidth' || !$layout_product) {
$primclass = 'no-sidebar';
}
}
} else {
$primclass = 'sidebar-default';
}
}
echo '<div id="primary" class="content-area ' . $primclass . '">';
}
示例4: ts_get_opt
/**
* Get theme option value
* @param string $option
* @return mix|boolean
*/
function ts_get_opt($option)
{
global $ts_theme_options;
$local = false;
//get local from main shop page
if (class_exists('WooCommerce') && (is_shop() || is_product_category() || is_product_tag())) {
$shop_page = woocommerce_get_page_id('shop');
if (!empty($shop_page)) {
$value = ts_get_post_opt($option . '-local', (int) $shop_page);
$local = true;
}
//get local from metaboxes for the post value and override if not empty
} else {
if (is_singular()) {
$value = ts_get_post_opt($option . '-local');
$local = true;
}
}
//return local value if exists
if ($local === true) {
//if $value is an array we need to check if first element is not empty before we return $value
$first_element = null;
if (is_array($value)) {
$first_element = reset($value);
}
if (is_string($value) && (strlen($value) > 0 || !empty($value)) || is_array($value) && !empty($first_element)) {
return $value;
}
}
if (isset($ts_theme_options[$option])) {
return $ts_theme_options[$option];
}
return false;
}
示例5: 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);
}
}
示例6: flatsome_admin_bar_helper
function flatsome_admin_bar_helper()
{
global $wp_admin_bar;
$optionUrl = get_admin_url() . 'themes.php?page=optionsframework';
$adminUrl = get_admin_url();
if (is_category() || is_home()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Blog Layout', 'href' => $optionUrl . '&tab=of-option-blog'));
}
if (ux_is_woocommerce_active()) {
if (is_checkout() || is_cart()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Checkout Settings', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=checkout'));
}
if (is_product()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Product Page Layout', 'href' => $optionUrl . '&tab=of-option-productpage'));
}
if (is_account_page()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'My Account Page', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=account'));
}
if (is_shop() || is_product_category()) {
$wp_admin_bar->add_menu(array('parent' => false, 'id' => 'admin_bar_helper', 'title' => 'Shop Settings'));
$wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_flatsome', 'title' => 'Category Page Layout', 'href' => $optionUrl . '&tab=of-option-categorypage'));
$wp_admin_bar->add_menu(array('parent' => 'admin_bar_helper', 'id' => 'admin_bar_helper_woocommerce', 'title' => 'Shop Page Display', 'href' => $adminUrl . 'admin.php?page=wc-settings&tab=products§ion=display'));
}
}
}
示例7: dt_woocommerce_init_template_config
/**
* Init theme config for shop.
*
*/
function dt_woocommerce_init_template_config($name = '')
{
dt_woocommerce_add_config_actions();
if ('shop' != $name) {
return;
}
$config = presscore_get_config();
$post_id = null;
if (is_shop()) {
$post_id = woocommerce_get_page_id('shop');
} else {
if (is_cart()) {
$post_id = woocommerce_get_page_id('cart');
} else {
if (is_checkout()) {
$post_id = woocommerce_get_page_id('checkout');
}
}
}
presscore_config_base_init($post_id);
if (is_product_category() || is_product_tag()) {
$post_id = woocommerce_get_page_id('shop');
if ($post_id) {
$config->set('post_id', $post_id);
presscore_config_populate_sidebar_and_footer_options();
$config->set('post_id', null);
}
}
if (!is_product()) {
add_filter('presscore_get_page_title', 'dt_woocommerce_get_page_title', 20);
}
// replace theme breadcrumbs
add_filter('presscore_get_breadcrumbs-html', 'dt_woocommerce_replace_theme_breadcrumbs', 20, 2);
}
示例8: woothemes_add_javascript
function woothemes_add_javascript()
{
global $woo_options;
wp_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto.js', array('jquery'));
wp_register_script('enable-lightbox', get_template_directory_uri() . '/includes/js/enable-lightbox.js', array('jquery', 'prettyPhoto'));
wp_register_script('google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
wp_register_script('google-maps-markers', get_template_directory_uri() . '/includes/js/markers.js');
wp_register_script('flexslider', get_template_directory_uri() . '/includes/js/jquery.flexslider-min.js', array('jquery'));
wp_register_script('featured-slider', get_template_directory_uri() . '/includes/js/featured-slider.js', array('jquery', 'flexslider'));
wp_register_script('infinite-scroll', get_template_directory_uri() . '/includes/js/jquery.infinitescroll.min.js', array('jquery'));
wp_register_script('masonry', get_template_directory_uri() . '/includes/js/jquery.masonry.min.js', array('jquery'));
wp_enqueue_script('third party', get_template_directory_uri() . '/includes/js/third-party.js', array('jquery'));
wp_enqueue_script('tiptip', get_template_directory_uri() . '/includes/js/jquery.tiptip.min.js', array('jquery'));
wp_enqueue_script('general', get_template_directory_uri() . '/includes/js/general.js', array('jquery'));
// Load Google Script on Contact Form Page Template
if (is_page_template('template-contact.php')) {
wp_enqueue_script('google-maps');
wp_enqueue_script('google-maps-markers');
}
// End If Statement
// Load infinite scroll on shop page / product cats
if (is_woocommerce_activated()) {
if ($woo_options['woocommerce_archives_infinite_scroll'] == 'true' && (is_shop() || is_product_category())) {
wp_enqueue_script('infinite-scroll');
}
}
// Load Masonry on the blog grid layout
if (is_page_template('template-blog-grid.php')) {
wp_enqueue_script('masonry');
add_action('wp_head', 'woo_fire_masonry');
}
do_action('woothemes_add_javascript');
}
示例9: 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'));
}
}
示例10: is_woocommerce
/**
* WooCommerce conditionals
*
* is_woocommerce - Returns true if on a page which uses WooCommerce templates (cart and checkout are standard pages with shortcodes and thus are not included)
**/
function is_woocommerce()
{
if (is_shop() || is_product_category() || is_product_tag() || is_product()) {
return true;
} else {
return false;
}
}
示例11: kadence_sidebar_id
function kadence_sidebar_id()
{
if (is_front_page()) {
global $virtue;
if (!empty($virtue['home_sidebar'])) {
$sidebar = $virtue['home_sidebar'];
} else {
$sidebar = 'sidebar-primary';
}
} else {
if (class_exists('woocommerce') and is_shop() || is_product_category() || is_product_tag()) {
global $virtue;
if (!empty($virtue['shop_sidebar'])) {
$sidebar = $virtue['shop_sidebar'];
} else {
$sidebar = 'sidebar-primary';
}
} elseif (class_exists('woocommerce') and is_account_page()) {
get_template_part('templates/account', 'sidebar');
$sidebar = "";
} elseif (is_page_template('page-blog.php') || is_page_template('page-sidebar.php') || is_page_template('page-feature-sidebar.php') || get_post_type() == 'post') {
global $post;
$sidebar_name = get_post_meta($post->ID, '_kad_sidebar_choice', true);
if (!empty($sidebar_name)) {
$sidebar = $sidebar_name;
} else {
$sidebar = 'sidebar-primary';
}
} else {
if (is_archive()) {
$sidebar = 'sidebar-primary';
} else {
if (is_category()) {
$sidebar = 'sidebar-primary';
} elseif (is_tag()) {
$sidebar = 'sidebar-primary';
} elseif (is_post_type_archive()) {
$sidebar = 'sidebar-primary';
} elseif (is_day()) {
$sidebar = 'sidebar-primary';
} elseif (is_month()) {
$sidebar = 'sidebar-primary';
} elseif (is_year()) {
$sidebar = 'sidebar-primary';
} elseif (is_author()) {
$sidebar = 'sidebar-primary';
} elseif (is_search()) {
$sidebar = 'sidebar-primary';
} else {
$sidebar = 'sidebar-primary';
}
}
}
}
return apply_filters('kadence_sidebar_id', $sidebar);
}
示例12: woocs_subcats_from_parentcat
function woocs_subcats_from_parentcat()
{
if (is_product_category()) {
global $wp_query;
$woocs_cat = $wp_query->get_queried_object();
$args = array('hierarchical' => 1, 'show_option_none' => '', 'hide_empty' => 0, 'parent' => $woocs_cat->term_id, 'taxonomy' => 'product_cat');
$woocs_subcats = get_categories($args);
}
return $woocs_subcats;
}
示例13: IsExtensionPage
function IsExtensionPage()
{
RWLogger::LogEnterence('WooCommerce_IsExtensionPage');
if (RWLogger::IsOn()) {
RWLogger::Log('WooCommerce_IsExtensionPage', 'is_product() = ' . json_encode(is_product()));
RWLogger::Log('WooCommerce_IsExtensionPage', 'is_product_category() = ' . json_encode(is_product_category()));
RWLogger::Log('WooCommerce_IsExtensionPage', 'is_shop() = ' . json_encode(is_shop()));
}
return $this->IsWooCommerce() && (is_product() || is_product_category() || is_shop());
}
示例14: get_categories
public static function get_categories()
{
global $wp_query;
$defaults = array('before' => '', 'after' => '', 'force_display' => false);
$args = array();
$args = wp_parse_args($args, $defaults);
extract($args);
$term = get_queried_object();
$parent_id = empty($term->term_id) ? 0 : $term->term_id;
if (is_product_category()) {
$display_type = get_woocommerce_term_meta($term->term_id, 'display_type', true);
switch ($display_type) {
case 'products':
return;
break;
case '':
if (get_option('woocommerce_category_archive_display') == '') {
return;
}
break;
}
}
$product_categories = get_categories(apply_filters('woocommerce_product_subcategories_args', array('parent' => $parent_id, 'menu_order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1, 'taxonomy' => 'product_cat', 'pad_counts' => 1)));
if (!apply_filters('woocommerce_product_subcategories_hide_empty', false)) {
$product_categories = wp_list_filter($product_categories, array('count' => 0), 'NOT');
}
if ($product_categories) {
echo $before;
foreach ($product_categories as $category) {
wc_get_template('content-product_cat.php', array('category' => $category));
}
if (is_product_category()) {
$display_type = get_woocommerce_term_meta($term->term_id, 'display_type', true);
switch ($display_type) {
case 'subcategories':
$wp_query->post_count = 0;
$wp_query->max_num_pages = 0;
break;
case '':
if (get_option('woocommerce_category_archive_display') == 'subcategories') {
$wp_query->post_count = 0;
$wp_query->max_num_pages = 0;
}
break;
}
}
if (is_shop() && get_option('woocommerce_shop_page_display') == 'subcategories') {
$wp_query->post_count = 0;
$wp_query->max_num_pages = 0;
}
echo $after;
return true;
}
}
示例15: nimber_show_per_row
function nimber_show_per_row()
{
if (is_shop()) {
$woo_layout = ot_get_option('woo_layout');
} elseif (is_product_category() || is_product_tag()) {
$woo_layout = ot_get_option('woo_archive_layout');
} else {
$woo_layout = 4;
}
return $woo_layout;
}