🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
WooCommerce官方免费主题: [https://wordpress.org/themes/storefront/](https://wordpress.org/themes/storefront/) WooCommerce Theme Support: ~~~ function mytheme_add_woocommerce_support() { add_theme_support( 'woocommerce' ); } add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' ); ~~~ [https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/](https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/) WooCommerce -> 产品 -> 导入 产品demo: [http://plugins.svn.wordpress.org/woocommerce/tags/](http://plugins.svn.wordpress.org/woocommerce/tags/) [http://plugins.svn.wordpress.org/woocommerce/tags/4.2.2/sample-data/](http://plugins.svn.wordpress.org/woocommerce/tags/4.2.2/sample-data/) WC Custom添加到购物车标签 [https://wordpress.org/plugins/wc-custom-add-to-cart-labels/](https://wordpress.org/plugins/wc-custom-add-to-cart-labels/) 选择显示产品的数量 [https://www.philowen.co/blog/add-a-products-per-page-dropdown-for-woocommerce/](https://www.philowen.co/blog/add-a-products-per-page-dropdown-for-woocommerce/) 选择显示的排序方式 [https://docs.woocommerce.com/document/custom-sorting-options-ascdesc/](https://docs.woocommerce.com/document/custom-sorting-options-ascdesc/) 默认的排序方式位置,wp-content\plugins\woocommerce\includes\wc-template-functions.php: ``` $catalog_orderby_options = apply_filters( 'woocommerce_catalog_orderby', array( 'menu_order' => __( 'Default sorting', 'woocommerce' ), 'popularity' => __( 'Sort by popularity', 'woocommerce' ), 'rating' => __( 'Sort by average rating', 'woocommerce' ), 'date' => __( 'Sort by latest', 'woocommerce' ), 'price' => __( 'Sort by price: low to high', 'woocommerce' ), 'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ), ) ); ``` 在functions.php里修改为: ``` /** * Add custom sorting options (asc/desc) */ add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' ); function custom_woocommerce_catalog_orderby( $sortby ) { $sortby['menu_order'] = __( 'Default sorting', 'woocommerce' ); $sortby['popularity'] = __( 'Sort by popularity', 'woocommerce' ); $sortby['rating'] = __( 'Sort by average rating', 'woocommerce' ); $sortby['date'] = __( 'Sort by latest', 'woocommerce' ); $sortby['price'] = __( 'Sort by price: low to high', 'woocommerce' ); $sortby['price-desc'] = __( 'Sort by price: high to low', 'woocommerce' ); // unset($sortby['menu_order']); unset($sortby['popularity']); unset($sortby['rating']); // unset($sortby['date']); // unset($sortby['price']); // unset($sortby['price-desc']); return $sortby; } ```