当前位置: 首页>>代码示例>>PHP>>正文


PHP is_woocommerce函数代码示例

本文整理汇总了PHP中is_woocommerce函数的典型用法代码示例。如果您正苦于以下问题:PHP is_woocommerce函数的具体用法?PHP is_woocommerce怎么用?PHP is_woocommerce使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_woocommerce函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: child_manage_woocommerce_styles

/**
 * Remove WooCommerce Generator tag, styles, and scripts from the homepage.
 * Tested and works with WooCommerce 2.0+
 *
 * @author Greg Rickaby
 * @since 2.0.0
 */
function child_manage_woocommerce_styles()
{
    remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator'));
    if (!is_woocommerce() && !is_cart() && !is_checkout()) {
        wp_dequeue_style('woocommerce_frontend_styles');
        wp_dequeue_style('woocommerce_fancybox_styles');
        wp_dequeue_style('woocommerce_chosen_styles');
        wp_dequeue_style('woocommerce_prettyPhoto_css');
        wp_dequeue_script('wc_price_slider');
        wp_dequeue_script('wc-single-product');
        wp_dequeue_script('wc-add-to-cart');
        wp_dequeue_script('wc-cart-fragments');
        wp_dequeue_script('wc-checkout');
        wp_dequeue_script('wc-add-to-cart-variation');
        wp_dequeue_script('wc-single-product');
        wp_dequeue_script('wc-cart');
        wp_dequeue_script('wc-chosen');
        wp_dequeue_script('woocommerce');
        wp_dequeue_script('prettyPhoto');
        wp_dequeue_script('prettyPhoto-init');
        wp_dequeue_script('jquery-blockui');
        wp_dequeue_script('jquery-placeholder');
        wp_dequeue_script('fancybox');
        wp_dequeue_script('jqueryui');
    }
}
开发者ID:vespertines,项目名称:wordpress_theme_starter,代码行数:33,代码来源:woocommerce.php

示例2: bootstrap_breadcrumbs

/**
 * Add breadcrumbs functionality to your WordPress theme
 *
 * Once you have included the function in your functions.php file
 * you can then place the following anywhere in your theme templates
 * if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
 *
 * credit to: c.bavota - http://bavotasan.com (thanks for the code start)
 */
function bootstrap_breadcrumbs()
{
    echo '<ol class="breadcrumb">';
    echo '<li><a href="' . home_url('/') . '">Home</a></li>';
    // are we at "blog home"?
    if (is_home()) {
        echo '<li><a href="#">Blogs</a></li>';
    }
    // where else do we want breadcrumbs
    if (!is_page_template('pt-home.php') && !is_home()) {
        // check if we're in a commerce plugin
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            echo '<li><a href="/publications/order/">Shop</a></li>';
            $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
            echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
        }
        // breadcrumb wordpress structures
        if (is_category() || is_single() || is_single('aof')) {
            if (get_the_category()) {
                $category = get_the_category();
                echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
            }
            if (is_single()) {
                echo '<li class="active">';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
    echo '</ol>';
}
开发者ID:ethicalux,项目名称:kairos_eux,代码行数:44,代码来源:wp_bootstrap_breadcrumbs.php

示例3: constructent_layout

/**
 * Get page layout
 *
 * @param string $default Default layout
 *
 * @return string
 */
function constructent_layout($default = 'sidebar-right')
{
    // Default layout
    $layout = $default;
    // Site layout
    if ($site_layout = constructent_option('site_layout')) {
        $layout = $site_layout;
    }
    // Singular page can have custom layout
    if (is_page()) {
        $custom_layout = constructent_meta('layout');
        if ($custom_layout && constructent_meta('custom_layout')) {
            $layout = $custom_layout;
        } else {
            $layout = constructent_option('page_layout');
        }
    }
    // Shop page layout
    if (function_exists('is_woocommerce') && is_woocommerce()) {
        $layout = constructent_option('shop_layout');
    }
    // Layout Full content
    if (is_page_template('tpl/portfolio.php') || is_singular('portfolio') || is_404()) {
        $layout = 'full-content';
    }
    if (is_tax('portfolio_category') && constructent_option('portfolio_columns')) {
        $layout = 'full-content';
    }
    // Allow to filter
    $layout = apply_filters(__FUNCTION__, $layout);
    return $layout;
}
开发者ID:GTACSolutions,项目名称:Telios,代码行数:39,代码来源:layout.php

示例4: wpex_get_sidebar

 function wpex_get_sidebar($sidebar = 'sidebar')
 {
     // Pages
     $custom_pages_sidebar = wpex_option('pages_custom_sidebar', '1');
     if (is_singular('pages') && $custom_pages_sidebar == '1') {
         return 'pages_sidebar';
     }
     // Staff
     $custom_staff_sidebar = wpex_option('staff_custom_sidebar', '1');
     if (is_singular('staff') && $custom_staff_sidebar == '1') {
         return 'staff_sidebar';
     }
     // Portfolio
     $custom_portfolio_sidebar = wpex_option('portfolio_custom_sidebar', '1');
     if (is_singular('portfolio') && $custom_portfolio_sidebar == '1') {
         return 'portfolio_sidebar';
     }
     // WooCommerce
     if (class_exists('Woocommerce')) {
         $woo_custom_sidebar = wpex_option('woo_custom_sidebar', '1');
         if ($woo_custom_sidebar == '1' && is_woocommerce()) {
             return 'woo_sidebar';
         }
     }
     // Return the correct sidebar name & add useful hook
     return apply_filters('wpex_get_sidebar', $sidebar);
 }
开发者ID:nhatnam1102,项目名称:wp-content,代码行数:27,代码来源:get-sidebar.php

示例5: child_manage_woocommerce_styles

function child_manage_woocommerce_styles()
{
    //remove generator meta tag
    remove_action('wp_head', array($GLOBALS['woocommerce'], 'generator'));
    //first check that woo exists to prevent fatal errors
    if (function_exists('is_woocommerce')) {
        //dequeue scripts and styles
        if (!is_woocommerce() && !is_cart() && !is_checkout()) {
            wp_dequeue_style('woocommerce_frontend_styles');
            wp_dequeue_style('woocommerce_fancybox_styles');
            wp_dequeue_style('woocommerce_chosen_styles');
            wp_dequeue_style('woocommerce_prettyPhoto_css');
            wp_dequeue_script('wc_price_slider');
            wp_dequeue_script('wc-single-product');
            wp_dequeue_script('wc-add-to-cart');
            wp_dequeue_script('wc-cart-fragments');
            wp_dequeue_script('wc-checkout');
            wp_dequeue_script('wc-add-to-cart-variation');
            wp_dequeue_script('wc-single-product');
            wp_dequeue_script('wc-cart');
            wp_dequeue_script('wc-chosen');
            wp_dequeue_script('woocommerce');
            wp_dequeue_script('prettyPhoto');
            wp_dequeue_script('prettyPhoto-init');
            wp_dequeue_script('jquery-blockui');
            wp_dequeue_script('jquery-placeholder');
            wp_dequeue_script('fancybox');
            wp_dequeue_script('jqueryui');
        }
    }
}
开发者ID:Chr15t1anRJW,项目名称:RJW-functionality-plugin,代码行数:31,代码来源:exclude-woo.php

示例6: woo_columns_body_class

 function woo_columns_body_class($classes)
 {
     if (is_woocommerce()) {
         $classes[] = 'columns-' . as_option('woo_listing_column_number');
     }
     return $classes;
 }
开发者ID:bibiangel1989,项目名称:vespatour,代码行数:7,代码来源:woocommerce_init.php

示例7: woodrobe_body_class

function woodrobe_body_class($classes)
{
    if (is_woocommerce() || is_cart() || is_checkout() || is_account_page()) {
        $classes[] = 'woodrobe';
    }
    return $classes;
}
开发者ID:peterjohnhunt,项目名称:woodrobe,代码行数:7,代码来源:woodrobe.php

示例8: ts_get_main_menu_style

/**
 * Get main menu style
 * @return type
 */
function ts_get_main_menu_style()
{
    $control_panel = ot_get_option('control_panel');
    if (ts_check_if_use_control_panel_cookies() && isset($_COOKIE['theme_main_menu_style']) && !empty($_COOKIE['theme_main_menu_style']) && ($control_panel == 'enabled_admin' && current_user_can('manage_options') || $control_panel == 'enabled_all')) {
        return $_COOKIE['theme_main_menu_style'];
    } else {
        if (isset($_GET['switch_main_menu_style']) && !empty($_GET['switch_main_menu_style'])) {
            return $_GET['switch_main_menu_style'];
        }
    }
    //get main menu style for specified page
    $main_menu_style = '';
    if (is_page()) {
        $main_menu_style = get_post_meta(get_the_ID(), 'main_menu_style', true);
    }
    if (!empty($main_menu_style) && $main_menu_style != 'default') {
        return $main_menu_style;
    } else {
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            return ot_get_option('shop_menu_style');
        } else {
            return ot_get_option('main_menu_style');
        }
    }
}
开发者ID:Sibzsolutions,项目名称:Schiffrinpa,代码行数:29,代码来源:framework.php

示例9: global_get_post_id

 function global_get_post_id() {
     if (function_exists('is_woocommerce') && is_woocommerce() && is_shop()) {
         
         return wc_get_page_id('shop');
     } 
     else if (is_singular()) {
         global $post;
         
         return $post->ID;
     } 
     else if (is_home()) {
         
         $page_on_front = get_option('page_on_front');
         $show_on_front = get_option('show_on_front');
         
         if ($page_on_front == 'page' && !empty($page_on_front)) {
             global $post;
             return $post->ID;
         } 
         else {
             return false;
         }
     } 
     else {
         
         return false;
     }
 }
开发者ID:sonololo,项目名称:gorodprima,代码行数:28,代码来源:global_post_id.php

示例10: ing_woo_content_end

function ing_woo_content_end()
{
    if (is_woocommerce()) {
        do_action("ing_content_close");
        echo "<!-- this is an addition -->";
    }
}
开发者ID:beardon,项目名称:okprop,代码行数:7,代码来源:functions.php

示例11: hwoo_set_product

/**
 * For some reason products in the loop don't get the right context by default.
 * @param $post
 */
function hwoo_set_product($post)
{
    global $post, $product;
    if (is_woocommerce()) {
        $product = wc_get_product($post->ID);
    }
}
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:11,代码来源:functions.php

示例12: 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_woocommerce()) {
             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');
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:33,代码来源:theme-js.php

示例13: wpcharming_logo_render

/**
 * Display logo base on page settings.
 */
function wpcharming_logo_render()
{
    global $post;
    global $woocommerce;
    $post_types = get_post_types('', 'names');
    $transparent_header_meta = null;
    $header_style = wpcharming_option('header_style');
    if ($woocommerce && is_woocommerce()) {
        $transparent_header_meta = get_post_meta(woocommerce_get_page_id('shop'), '_wpc_transparent_header', true);
    } else {
        foreach ($post_types as $post_type) {
            if (is_singular($post_type)) {
                global $post;
                $transparent_header_meta = get_post_meta($post->ID, '_wpc_transparent_header', true);
            }
        }
    }
    if ($transparent_header_meta == 'on' && $header_style == 'header-default') {
        if (isset($_REQUEST['header-demo'])) {
            $logo_url = wpcharming_option('site_logo', false, 'url');
        } else {
            $logo_url = wpcharming_option('site_transparent_logo', false, 'url');
        }
    } else {
        $logo_url = wpcharming_option('site_logo', false, 'url');
    }
    return $logo_url;
}
开发者ID:mertyildiran,项目名称:grandinsaat,代码行数:31,代码来源:template-tags.php

示例14: query_parsed_init

 function query_parsed_init()
 {
     global $gantry, $woocommerce;
     if (is_woocommerce()) {
         remove_filter('template_include', array($woocommerce, 'template_loader'));
         add_filter('gantry_mainbody_include', array('GantryGizmoWooCommerce', 'include_woocommerce_template'));
     }
 }
开发者ID:rotoballer,项目名称:emily,代码行数:8,代码来源:woocommerce.php

示例15: simple_life_hooking_woo

/**
 * Hooking WooCommerce.
 */
function simple_life_hooking_woo()
{
    remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    if (is_woocommerce() && true === simple_life_get_option('enable_breadcrumb')) {
        add_action('simple_life_action_after_header', 'woocommerce_breadcrumb');
        remove_action('simple_life_action_after_header', 'simple_life_add_breadcrumb');
    }
}
开发者ID:ernilambar,项目名称:simple-life,代码行数:11,代码来源:woocommerce.php


注:本文中的is_woocommerce函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。