示例#1
0
        wp_nav_menu(array('theme_location' => 'mobile', 'container' => 'ul', 'menu_id' => 'mobile-cg-mobile-menu', 'menu_class' => 'mobile-menu-wrap', 'walker' => new mobile_cg_menu()));
    } elseif (function_exists('has_nav_menu') && has_nav_menu('primary')) {
        wp_nav_menu(array('theme_location' => 'primary', 'container' => 'ul', 'menu_id' => 'mobile-cg-primary-menu', 'menu_class' => 'mobile-menu-wrap', 'walker' => new mobile_cg_menu()));
    }
    ?>
                </div><!--/mobile-menu -->
            <?php 
}
?>

            <div id="cg-page-wrap" class="hfeed site">
                <?php 
do_action('before');
?>
                <?php 
if (is_wc_active()) {
    ?>
 
                    <?php 
    if (function_exists('wc_print_notices')) {
        ?>
                        <?php 
        $cg_wc_notices = WC()->session->get('wc_notices', array());
        if (!empty($cg_wc_notices)) {
            ?>
                            <div class="cg-wc-messages">
                                <div class="container">
                                    <div class="row">
                                        <div class="col-lg-12">
                                            <?php 
            wc_print_notices();
示例#2
0
function cg_woo_cat_banner()
{
    if (is_wc_active()) {
        if (is_product_category()) {
            // Get our custom category banner if it exists
            $queried_object = '';
            $taxonomy = '';
            $term_id = '';
            $cat_banner = '';
            $cg_woo_cat_banner_src = '';
            $cg_woo_cat_banner_css = '';
            $queried_object = get_queried_object();
            if (isset($queried_object->taxonomy)) {
                $taxonomy = $queried_object->taxonomy;
                $term_id = $queried_object->term_id;
            }
            if (function_exists('get_field')) {
                $cat_banner = get_field('product_category_banner', $taxonomy . '_' . $term_id);
                if (!empty($cat_banner)) {
                    $cg_woo_cat_banner_src = wp_get_attachment_image_src($cat_banner, 'product-category-banner');
                    // returns an array
                    if (!empty($cg_woo_cat_banner_src)) {
                        $cg_woo_cat_banner_css .= "\n                                .header-wrapper {\n                                    /* 4 */\n                                    background: url( {$cg_woo_cat_banner_src['0']} ) no-repeat top center; background-size: cover;\n                                }\n                            ";
                        wp_add_inline_style('cg-commercegurus', $cg_woo_cat_banner_css);
                    }
                }
            }
        }
    }
}