/*
Theme Name: WD
Theme URI: https://wd.ancorathemes.com/
Description: WD is a Premium WordPress theme that has built-in support for popular Page Builders, slider with swipe gestures, and is SEO- and Retina-ready. The unique system of inheritance and override options allows setting up individual parameters for different sections of your site and supported plugins.
Author: AncoraThemes
Author URI: https://ancorathemes.com/
Version: 2.5.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: windows, doors, kitchen cabinets, renovation, remodeling, construction, replacement, diy, handyman, craftsman, makeover, hardware, shop, manufacture, interior design
Text Domain: wd
*/
/* TABLE OF CONTENTS:

1. Reset tags and predefined classes
2+ See in the active skin styles

-------------------------------------------------------------- */
/* 1. Reset tags
-------------------------------------------------------------- */
html, body, div, span, applet, object, iframe, video, audio,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, input, textarea, button,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, address, section {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  font-weight: inherit;
  font-style: inherit;
  outline: 0;
  -ms-word-wrap: break-word;
  word-wrap: break-word;
}

applet, object, iframe, video, audio,
fieldset, form, label, legend, input, textarea, button,
table, caption, tbody, tfoot, thead, tr, th, td {
  border: 0;
}

html {
  font-size: 100%;
  /*62.5%;*/
                	          		/* Corrects text resizing oddly in IE6/7 when body font-size is set using em units
									   http://clagnut.com/blog/348/#c790 */
  -webkit-text-size-adjust: 100%;
  /* Prevents iOS text size adjust after orientation change, without disabling user zoom */
  -ms-text-size-adjust: 100%;
                            	/* www.456bereastreet.com/archive/201012/
									   controlling_text_size_in_safari_for_ios_without_disabling_user_zoom/ */
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
html:not(.edit-post-visual-editor) {
  height: 100%;
  overflow-y: scroll !important;
  overflow-x: hidden;
}

html:not(.edit-post-visual-editor),
body:not(.edit-post-visual-editor) {
  margin: 0;
  padding: 0;
  width: 100%;
}

div.ui-widget,
div.ui-widget .ui-widget,
div.ui-widget .ui-widget-header,
div.ui-widget .ui-widget-content,
div.ui-accordion .ui-accordion-header,
div.ui-state-default,
div.ui-widget-content .ui-state-default,
div.ui-widget-header .ui-state-default {
  font-family: inherit;
  font-size: 1em;
  line-height: inherit;
}

div.ui-widget,
div.ui-widget .ui-widget,
div.ui-widget .ui-widget-header,
div.ui-widget .ui-widget-content,
div.ui-accordion .ui-accordion-header,
div.ui-state-default,
div.ui-widget-content .ui-state-default,
div.ui-widget-header .ui-state-default {
  color: inherit;
  background: none;
  border-style: none;
  -webkit-border-radius: 0;
  -ms-border-radius: 0;
  border-radius: 0;
}

div.ui-datepicker {
  background-color: #fff;
}

div.ui-accordion .ui-accordion-header {
  padding: 0;
}

div.ui-accordion .ui-accordion-header-icon {
  display: none;
}

div.ui-tabs,
div.ui-tabs .ui-tabs-panel,
div.ui-tabs .ui-tabs-nav {
  padding: 0;
}

div.ui-tabs .ui-tabs-nav li {
  float: none;
  margin: 0;
}

div.ui-tabs .ui-tabs-nav .ui-tabs-anchor {
  float: none;
}

/* Predefined classes for users
-------------------------------------------------------------- */
/* Round object corners */
.rounded_none {
  -webkit-border-radius: 0;
  -ms-border-radius: 0;
  border-radius: 0;
}

.rounded_tiny {
  -webkit-border-radius: 4px;
  -ms-border-radius: 4px;
  border-radius: 4px;
}

.rounded_small {
  -webkit-border-radius: 6px;
  -ms-border-radius: 6px;
  border-radius: 6px;
}

.rounded_medium {
  -webkit-border-radius: 10px;
  -ms-border-radius: 10px;
  border-radius: 10px;
}

.rounded_large {
  -webkit-border-radius: 15px;
  -ms-border-radius: 15px;
  border-radius: 15px;
}

.rounded {
  -webkit-border-radius: 50%;
  -ms-border-radius: 50%;
  border-radius: 50%;
}

/* Overflow hidden */
.overflow_hidden {
  overflow: hidden !important;
}

.overflow_x_hidden {
  overflow-x: hidden !important;
}

.overflow_y_hidden {
  overflow-y: hidden !important;
}

/*# sourceMappingURL=style.css.map */
/**
 * 为WooCommerce启用“纯展示模式”
 */
function disable_woocommerce_commerce() {
    
    // 1. 从商品循环和单个商品页面移除“加入购物车”按钮
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    
    // 2. 隐藏商品价格
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price' );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    
    // 3. 将购物车和结算页面重定向到首页（可选，但强烈推荐）
    function redirect_cart_and_checkout_pages() {
        if ( is_cart() || is_checkout() ) {
            wp_redirect( home_url() );
            exit;
        }
    }
    add_action( 'template_redirect', 'redirect_cart_and_checkout_pages' );
    
    // 4. 从菜单中移除购物车（如果它存在）
    function remove_cart_menu_item( $items, $args ) {
        if ( $args->theme_location == 'primary' ) { // 将 'primary' 替换为您主题的菜单位置
            foreach ( $items as $key => $item ) {
                if ( $item->title == 'Cart' ) {
                    unset( $items[ $key ] );
                }
            }
        }
        return $items;
    }
    // 注意：这行代码可以根据需要注释掉，因为重定向已经解决了主要问题
    // add_filter( 'wp_nav_menu_objects', 'remove_cart_menu_item', 10, 2 );
    
}
add_action( 'init', 'disable_woocommerce_commerce' );
/**
 * 清理WooCommerce后台菜单，仅保留“商品”和“设置”等核心功能
 */
function customize_woocommerce_admin_menu() {
    // 检查用户是否有管理员权限，避免影响其他用户角色
    if ( ! current_user_can( 'manage_options' ) ) {
        return;
    }

    global $menu, $submenu;

    // 1. 移除顶级菜单项：优惠券、营销、分析、报表
    remove_menu_page( 'edit.php?post_type=shop_coupon' ); // 优惠券
    remove_menu_page( 'wc-admin&path=/marketing' );       // 营销 (路径可能因版本而异)
    remove_menu_page( 'wc-admin&path=/analytics' );       // 分析
    remove_menu_page( 'wc-reports' );                     // 报表 (旧版)

    // 2. 精准移除 WooCommerce > 订单 和 客户 子菜单
    if ( isset( $submenu['woocommerce'] ) ) {
        foreach ( $submenu['woocommerce'] as $key => $item ) {
            // 移除“订单”子菜单
            if ( in_array( 'edit.php?post_type=shop_order', $item ) ) {
                unset( $submenu['woocommerce'][$key] );
            }
            // 移除“客户”子菜单 (针对 WooCommerce 会员功能)
            if ( isset( $item[2] ) && $item[2] === 'wc-admin&path=/customers' ) {
                unset( $submenu['woocommerce'][$key] );
            }
        }
    }

    // 3. 直接从全局 $menu 中移除“状态”和“分析”菜单 (更彻底的方法)
    remove_menu_page( 'wc-admin&path=/analytics/overview' ); // 分析总览
    remove_menu_page( 'wc-status' );                         // 状态
}
add_action( 'admin_menu', 'customize_woocommerce_admin_menu', 99 ); // 优先级设高，确保最后执行