🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
【主题支持】 function.php的woocommerce theme支持代码: ~~~ // WooCommerce Theme Support add_action( 'after_setup_theme', 'woocommerce_support' ); function woocommerce_support() { add_theme_support( 'woocommerce' ); } ~~~ 【body样式】 woocommerce默认body样式 `<body <?php body_class(); ?>>` woocommerce theme开发参考: https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/ 【面包屑】 woocommerce默认的面包屑: `<?php woocommerce_breadcrumb(); ?>` 案例: ~~~ <div class="breadcrumb"> <div class="container"> <?php woocommerce_breadcrumb(); ?> </div> </div> ~~~ 对应添加的functions.php代码: ~~~ // Change woocommerce defaults breadcrumb add_filter( 'woocommerce_breadcrumb_defaults', 'woo_woocommerce_breadcrumbs' ); function woo_woocommerce_breadcrumbs() { return array( 'delimiter' => ' &#47; ', 'wrap_before' => '<div class="breadcrumb-inner"> <ul class="list-inline list-unstyled">', 'wrap_after' => '</ul> </div>', 'before' => '', 'after' => '', 'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ), ); } ~~~ 实际的html是: ~~~ <div class="breadcrumb"> <div class="container"> <div class="breadcrumb-inner"> <ul class="list-inline list-unstyled"> <li><a href="#">实际</a></li> <li class="active">位置</li> </ul> </div> </div> </div> ~~~ 移除面包屑的functions.php代码: ~~~ // Remove woocommerce defaults breadcrumb add_action( 'init', 'woo_remove_wc_breadcrumbs' ); function woo_remove_wc_breadcrumbs() { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } ~~~