{"id":528887,"date":"2021-11-09T13:54:50","date_gmt":"2021-11-09T05:54:50","guid":{"rendered":"https:\/\/loyseo.com\/code-snippet\/woocommerce%ef%bc%9a-%e5%a6%82%e4%bd%95%e5%88%aa%e9%99%a4-default-sorting-%e9%a0%90%e8%a8%ad%e6%8e%92%e5%ba%8f-%e4%b8%8b%e6%8b%89%e9%81%b8%e9%a0%85\/"},"modified":"2023-08-25T14:39:51","modified_gmt":"2023-08-25T06:39:51","slug":"woocommerce-how-to-remove-the-default-sorting-dropdown","status":"publish","type":"code-snippet","link":"https:\/\/loyseo.com\/zh-hant\/code-snippet\/woocommerce-how-to-remove-the-default-sorting-dropdown\/","title":{"rendered":"WooCommerce\uff1a \u5982\u4f55\u522a\u9664 \u201cDefault Sorting\/\u9810\u8a2d\u6392\u5e8f\u201d \u4e0b\u62c9\u9078\u9805"},"content":{"rendered":"\n<p>\u5982\u679c<a href=\"https:\/\/loyseo.com\/zh-hant\/tutorial\/woocommerce\/\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/loyseo.com\/tutorial\/woocommerce\/\" rel=\"noreferrer noopener\">WooCommerc<\/a>e\u7684\u7522\u54c1\u6392\u5e8f\u529f\u80fd\u5c0d\u4f60\u800c\u8a00\u662f\u6c92\u7528\u7684\uff08\u5373\u4e0b\u5716\u4e2d\u7684default sorting\u4e0b\u62c9\u9078\u9805\uff09\uff0c\u4f60\u53ef\u80fd\u60f3\u628a\u5b83\u5f9e\u9801\u9762\u4e0a\u522a\u9664\u3002<\/p>\n\n<p>\u63a5\u4e0b\u4f86\u9019\u500bPHP \u4ee3\u78bc\u6bb5\u7c21\u76f4\u6bd4CSS\u9084\u7c21\u55ae\u6e05\u723d\uff0c\u4f60\u53ea\u9700\u8981\u628a\u6211\u7684\u4ee3\u78bc\u6bb5\u6dfb\u52a0\u5230<a href=\"https:\/\/loyseo.com\/zh-hant\/plugins\/code-snippets\/\" target=\"_blank\" rel=\"noopener\" data-schema-attribute=\"\">Code Snippet<\/a>\u5916\u639b\u7a0b\u5f0f\u4e2d\u3002<\/p>\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"541\" src=\"https:\/\/loyseo.com\/wp-content\/uploads\/2021\/11\/woocommerce-remove-default-sorting-dropdown.png\" alt=\"\" class=\"wp-image-513428\" title=\"-\"><\/figure>\n\n<p>WooCommerce\uff1a \u96b1\u85cf \u201cDefault Sorting\u201d \u4e0b\u62c9\u9078\u9805<\/p>\n\n<h2 class=\"wp-block-heading\">PHP Snippet 1\uff1a \u5f9ewoocommerce\u5546\u5e97\u9996\u9801\u548c\u7522\u54c1\u5217\u8868\u9801\u4e2d\u522a\u9664 \u201cDefault Sorting\/\u9810\u8a2d\u6392\u5e8f\u201d\u4e0b\u62c9\u9078\u9805<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code>\n* @snippet       Remove \"Default Sorting\" Dropdown @ WooCommerce Shop &amp; Archive Pages\n* @author        Rodolfo Melogli\n* @compatible    Woo 3.8\n*\/\nremove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );\n<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">PHP Snippet 2\uff1a \u522a\u9664StoreFront\u4e3b\u984c\u4e2d\u7684 \u300c\u9810\u8a2d\u6392\u5e8f \u300d\u4e0b\u62c9\u9078\u9805<\/h2>\n\n<pre class=\"wp-block-preformatted\">* <code>@snippet       Remove \"Default Sorting\" Dropdown @ StoreFront Shop & Archive Pages\n* @compatible    Woo 3.8\n*\/\nadd_action( 'wp', 'bbloomer_remove_default_sorting_storefront' );\nfunction bbloomer_remove_default_sorting_storefront() {\nremove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );\nremove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );\n}<\/code>\n<\/pre>\n\n<h2 class=\"wp-block-heading\">\u5176\u4ed6\u60c5\u6cc1<\/h2>\n\n<p>\u901a\u5e38\uff0c\u4ed8\u8cbb\u7684\u3001\u71b1\u92b7\u7684\u512a\u79c0\u4e3b\u984c\u80fd\u5920\u63d0\u4f9b\u79fb\u9664\u9810\u8a2d\u6392\u5e8f\u7684\u529f\u80fd\uff0c\u4e26\u4e14\u4e0d\u9700\u8981\u4f60\u4f7f\u7528\u4e0a\u8ff0\u4ee3\u78bc\u3002 \u8b6c\u5982<a href=\"https:\/\/member.loyseo.cn\/course-category\/benefits\/\" data-type=\"product\" data-id=\"687\" target=\"_blank\" rel=\"noopener\">Astra\u4e3b\u984c\u4ed8\u8cbb\u7248<\/a>\uff0c\u5728\u5916\u89c0-\u81ea\u5b9a\u7fa9-woocommerce-\u7522\u54c1\u5217\u8868\u4e2d\u5c31\u53ef\u4ee5\u95dc\u9589Display Toolbar\u7684\u5c55\u793a\uff0cDisplay Toolbar\u4e2d\u5c31\u5305\u542b\u4e86\u9810\u8a2d\u6392\u5e8f\u529f\u80fd\u3002<\/p>\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679cWooCommerce\u7684\u7522\u54c1\u6392\u5e8f\u529f\u80fd\u5c0d\u4f60\u800c\u8a00\u662f\u6c92\u7528\u7684\uff08\u5373\u4e0b\u5716\u4e2d\u7684default sorting\u4e0b\u62c9\u9078\u9805\uff09\uff0c\u4f60\u53ef\u80fd\u60f3\u628a\u5b83\u5f9e\u9801\u9762\u4e0a\u522a\u9664\u3002 \u63a5\u4e0b\u4f86\u9019\u500bPHP \u4ee3\u78bc\u6bb5\u7c21\u76f4\u6bd4CSS\u9084\u7c21\u55ae\u6e05\u723d\uff0c\u4f60\u53ea\u9700\u8981\u628a\u6211\u7684\u4ee3\u78bc\u6bb5\u6dfb\u52a0\u5230Code Snippet\u5916\u639b\u7a0b\u5f0f\u4e2d\u3002 WooCommerce\uff1a \u96b1\u85cf \u201cDefault Sorting\u201d \u4e0b\u62c9\u9078\u9805 PHP Snippet 1\uff1a \u5f9ewoocommerce\u5546\u5e97\u9996\u9801\u548c\u7522\u54c1\u5217\u8868 [&hellip;]<\/p>\n","protected":false},"featured_media":0,"template":"","class_list":["post-528887","code-snippet","type-code-snippet","status-publish","hentry"],"acf":[],"taxonomy_info":[],"featured_image_src_large":false,"author_info":[],"comment_info":"","_links":{"self":[{"href":"https:\/\/loyseo.com\/zh-hant\/wp-json\/wp\/v2\/code-snippet\/528887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/loyseo.com\/zh-hant\/wp-json\/wp\/v2\/code-snippet"}],"about":[{"href":"https:\/\/loyseo.com\/zh-hant\/wp-json\/wp\/v2\/types\/code-snippet"}],"wp:attachment":[{"href":"https:\/\/loyseo.com\/zh-hant\/wp-json\/wp\/v2\/media?parent=528887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}