• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_woocommerce函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: thb_breadcrumb

function thb_breadcrumb()
{
    global $post, $wp_query;
    $id = $wp_query->get_queried_object_id();
    echo '<aside class="breadcrumb">';
    if (!is_front_page()) {
        echo '<a href="';
        echo home_url();
        echo '">' . __('Home', THB_THEME_NAME);
        echo "</a>";
    }
    if (is_singular('portfolio')) {
        $portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
        if ($portfolio_main) {
            $portfolio_link = get_permalink($portfolio_main);
        } else {
            $portfolio_link = get_portfolio_page_link(get_the_ID());
        }
        echo '<span>/</span> <a href="' . $portfolio_link . '">' . __('Portfolio', THB_THEME_NAME) . '</a>';
        echo '<span>/</span>' . get_the_title();
    }
    if (is_home()) {
        echo '<span>/</span>' . __('Blog', THB_THEME_NAME);
    }
    if (is_page() && !is_front_page()) {
        $parents = array();
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $parents[] = '<span>/</span><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a>';
            $parent_id = $page->post_parent;
        }
        $parents = array_reverse($parents);
        echo join(' ', $parents);
        echo '<span>/</span>' . get_the_title();
    }
    if (is_single() && !is_singular('portfolio')) {
        $categories = get_the_category();
        if ($categories) {
            foreach ($categories as $cat) {
                $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
            }
            echo '<span>/</span>' . join(', ', $cats);
        }
        echo '<span>/</span>' . ShortenText(get_the_title(), 40);
    }
    if (is_archive()) {
        if (class_exists('woocommerce') && is_woocommerce() && is_shop()) {
            echo '<span>/</span>' . get_the_title(wc_get_page_id('shop'));
        } else {
            echo '<span>/</span>' . thb_which_archive();
        }
    }
    if (is_search()) {
        echo '<span>/</span>' . thb_which_archive();
    }
    echo '</aside>';
}
开发者ID:primarydesign,项目名称:the-color-mint,代码行数:58,代码来源:breadcrumbs.php


示例17: tabbysplace_scripts_styles

/**
 * Enqueue scripts and styles for front-end.
 *
 */
function tabbysplace_scripts_styles()
{
    global $wp_styles;
    /*
     * Adds JavaScript to pages with the comment form to support
     * sites with threaded comments (when in use).
     */
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }
    //Loads Javascripts
    $tabby_param = array('ajax_url' => admin_url('admin-ajax.php'));
    wp_localize_script('jquery', 'tabby_param', $tabby_param);
    if (is_page_template('page-templates/news-archives.php')) {
        wp_enqueue_style('tabbysplace-owlcss', get_template_directory_uri() . '/css/owl.carousel.css', array(), '');
        wp_enqueue_script('tabbysplace-owl', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-tabby-news-archives', get_template_directory_uri() . '/js/tabby-news-archives.js', array('jquery'), '', true);
    }
    if (is_front_page()) {
        wp_enqueue_script('tabbysplace-home', get_template_directory_uri() . '/js/tabbysplace-home.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-bxsliderJs', get_template_directory_uri() . '/js/bxslider.js', array('jquery'), '', true);
        wp_enqueue_style('tabbysplace-bxslidercss', get_template_directory_uri() . '/css/bxslider.css', array(), '');
    }
    wp_enqueue_script('tabbysplace-placeholder', get_template_directory_uri() . '/js/jquery.placeholder.min.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-css-browser-selector', get_template_directory_uri() . '/js/css_browser_selector.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-modernizr', get_template_directory_uri() . '/js/modernizr.min.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-equalheight', get_template_directory_uri() . '/js/jquery.equalheight.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-menu', get_template_directory_uri() . '/js/menu.js', array('jquery'), '', true);
    wp_enqueue_script('tabbysplace-generaljs', get_template_directory_uri() . '/js/general.js', array('jquery'), '', true);
    //	if (is_page_template('page-templates/contact.php')) {
    if (!is_woocommerce()) {
        wp_enqueue_style('tabbysplace-selectbox-css', get_template_directory_uri() . '/css/jquery.selectbox.css', array(), '');
        wp_enqueue_script('tabbysplace-selectbox-js', get_template_directory_uri() . '/js/jquery.selectbox-0.2.js', array('jquery'), '', true);
    }
    if (is_page_template('page-templates/virtual-tour.php') || is_singular('virtual-tour')) {
        wp_enqueue_style('tabbysplace-owlcss', get_template_directory_uri() . '/css/owl.carousel.css', array(), '');
        wp_enqueue_style('tabbysplace-magnific-popupcss', get_template_directory_uri() . '/css/magnific-popup.css', array(), '');
        wp_enqueue_script('tabbysplace-magnific-popupjs', get_template_directory_uri() . '/js/magnific-popup.min.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-owl', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-imagemapster', get_template_directory_uri() . '/js/jquery.imagemapster.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-virtual-tour', get_template_directory_uri() . '/js/tabbysplace-virtual-tour.js', array('jquery'), '', true);
        $video_type = get_field('room_video_type', get_the_ID());
        $video_id = get_field('room_' . $video_type . '_video_id', get_the_ID());
        $tabby_tour_param = array('virtual_tour_map' => get_template_directory_uri() . '/images/map-lightbox.png', 'virtual_tour_map_filled' => get_template_directory_uri() . '/images/map-lightbox-filled.png', 'virtual_tour_smallmap_filled' => get_template_directory_uri() . '/images/small-map-filled.png', 'virtual_tour_current_mapid' => get_field('map_location_id', get_the_ID()), 'virtual_tour_video_type' => $video_type, 'virtual_tour_video_id' => $video_id);
        wp_localize_script('tabbysplace-virtual-tour', 'tabby_tour_param', $tabby_tour_param);
    }
    if (is_page_template('page-templates/adopt.php') || is_page_template('page-templates/sponsor.php')) {
        wp_enqueue_style('tabbysplace-owlcss', get_template_directory_uri() . '/css/owl.carousel.css', array(), '');
        wp_enqueue_script('tabbysplace-touchSwipe', get_template_directory_uri() . '/js/jquery.touchSwipe.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-owl', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '', true);
        wp_enqueue_script('tabbysplace-cat-listing', get_template_directory_uri() . '/js/tabbysplace-cat-listing.js', array('jquery'), '', true);
    }
    // Loads our main stylesheet.
    wp_enqueue_style('tabbysplace-style', get_stylesheet_uri());
    wp_enqueue_style('tabbysplace-responsive', get_template_directory_uri() . '/responsive.css', array('tabbysplace-style'), '');
    wp_enqueue_style('tabbysplace-virtual-tour', get_template_directory_uri() . '/virtual-tour.css', array('tabbysplace-style'), '');
    wp_enqueue_style('tabbysplace-fonts', get_template_directory_uri() . '/css/fonts.css', array('tabbysplace-style'), '');
}
开发者ID:slavic18,项目名称:cats,代码行数:62,代码来源:general-functions.php


示例18: gmdl_add_mini_cart

function gmdl_add_mini_cart()
{
    global $woo_options;
    global $woocommerce;
    if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_woocommerce()) {
        $mini_cart = '<a href="' . esc_url($woocommerce->cart->get_cart_url()) . '" class="mini-cart"><span>' . $woocommerce->cart->cart_contents_count . '</span></a>';
        echo $mini_cart;
    }
}
开发者ID:kosovish,项目名称:genesis-material-design-lite-child-theme,代码行数:9,代码来源:menu.php


示例19: wpcharming_body_classes

/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function wpcharming_body_classes($classes)
{
    global $woocommerce;
    global $post;
    if (is_page_template('template-fullwidth.php') || is_404()) {
        $classes[] = 'page-fullwidth';
    }
    // WooCommerce
    if ($woocommerce) {
        $woo_layout = get_post_meta(woocommerce_get_page_id('shop'), '_wpc_page_layout', true);
        if ($woo_layout == 'right-sidebar' || $woo_layout == 'left-sidebar') {
            $classes[] = 'shop-has-sidebar';
        }
    }
    // Boxed Layout
    if (wpcharming_option('site_boxed') || isset($_REQUEST['boxed_layout']) && ($_REQUEST['boxed_layout'] = 'enable')) {
        $classes[] = 'layout-boxed';
    }
    // Header Style
    if (wpcharming_option('header_style') || wpcharming_option('header_style') !== '') {
        if (isset($_REQUEST['header-demo'])) {
            $classes[] = 'header-' . $_REQUEST['header-demo'];
        } else {
            $classes[] = 'header-' . wpcharming_option('header_style');
        }
    } else {
        $classes[] = 'header-default';
    }
    // Fixed Header
    if (wpcharming_option('header_fixed')) {
        $classes[] = 'header-fixed-on';
    }
    // Transparent Header
    $post_types = get_post_types('', 'names');
    $header_style = wpcharming_option('header_style');
    $transparent_header_meta = null;
    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'])) {
            $classes[] = 'header-normal';
        } else {
            $classes[] = 'header-transparent';
        }
    } else {
        $classes[] = 'header-normal';
    }
    return $classes;
}
开发者ID:mertyildiran,项目名称:grandinsaat,代码行数:63,代码来源:extras.php


示例20: siteorigin_north_woocommerce_enqueue_scripts

function siteorigin_north_woocommerce_enqueue_scripts()
{
    if (!function_exists('is_woocommerce')) {
        return;
    }
    if (is_woocommerce()) {
        wp_enqueue_script('siteorigin-north-woocommerce', get_template_directory_uri() . '/js/woocommerce.js', array('jquery'), SITEORIGIN_THEME_VERSION);
    }
}
开发者ID:adiraomj,项目名称:siteorigin-north,代码行数:9,代码来源:functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_woocommerce_activated函数代码示例发布时间:2022-05-15
下一篇:
PHP is_windows函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap