{"id":56201,"date":"2024-10-10T09:36:19","date_gmt":"2024-10-10T01:36:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/56201\/"},"modified":"2024-10-10T09:36:19","modified_gmt":"2024-10-10T01:36:19","slug":"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%af%a6%e7%8f%be-wordpress-%e5%92%8c-woocommerce-%e6%96%87%e7%ab%a0%e9%87%8d%e6%96%b0%e6%8e%92%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/56201\/","title":{"rendered":"WordPress \u6559\u7a0b\uff1a\u5982\u4f55\u5be6\u73fe WordPress \u548c WooCommerce \u6587\u7ae0\u91cd\u65b0\u6392\u5e8f"},"content":{"rendered":"<h1 id=\"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%af%a6%e7%8f%be-wordpress-%e5%92%8c-woocommerce-%e6%96%87%e7%ab%a0%e9%87%8d%e6%96%b0%e6%8e%92%e5%ba%8f-JhzaOoyEBU\">WordPress \u6559\u7a0b\uff1a\u5982\u4f55\u5be6\u73fe WordPress \u548c WooCommerce \u6587\u7ae0\u91cd\u65b0\u6392\u5e8f<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u5b57\u6642\u4ee3\uff0c\u7db2\u7ad9\u7684\u5167\u5bb9\u7ba1\u7406\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002\u5c0d\u65bc\u4f7f\u7528 WordPress \u548c WooCommerce \u7684\u7db2\u7ad9\u4f86\u8aaa\uff0c\u6587\u7ae0\u7684\u6392\u5e8f\u4e0d\u50c5\u5f71\u97ff\u7528\u6236\u9ad4\u9a57\uff0c\u9084\u6703\u5f71\u97ff SEO \u6392\u540d\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 WordPress \u548c WooCommerce \u4e2d\u5be6\u73fe\u6587\u7ae0\u7684\u91cd\u65b0\u6392\u5e8f\uff0c\u5e6b\u52a9\u60a8\u66f4\u597d\u5730\u7ba1\u7406\u7db2\u7ad9\u5167\u5bb9\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e9%87%8d%e6%96%b0%e6%8e%92%e5%ba%8f%e6%96%87%e7%ab%a0%ef%bc%9f-JhzaOoyEBU\">\u70ba\u4ec0\u9ebc\u9700\u8981\u91cd\u65b0\u6392\u5e8f\u6587\u7ae0\uff1f<\/h2>\n<p>\u91cd\u65b0\u6392\u5e8f\u6587\u7ae0\u7684\u539f\u56e0\u6709\u5f88\u591a\uff0c\u4e3b\u8981\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u63d0\u5347\u7528\u6236\u9ad4\u9a57\uff1a<\/strong>\u901a\u904e\u5c07\u6700\u91cd\u8981\u6216\u6700\u65b0\u7684\u6587\u7ae0\u653e\u5728\u986f\u773c\u7684\u4f4d\u7f6e\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7528\u6236\u7684\u700f\u89bd\u9ad4\u9a57\u3002<\/li>\n<li><strong>\u589e\u5f37 SEO \u6548\u679c\uff1a<\/strong>\u641c\u7d22\u5f15\u64ce\u901a\u5e38\u6703\u512a\u5148\u8003\u616e\u6700\u65b0\u6216\u6700\u76f8\u95dc\u7684\u5167\u5bb9\uff0c\u91cd\u65b0\u6392\u5e8f\u53ef\u4ee5\u5e6b\u52a9\u63d0\u9ad8\u7db2\u7ad9\u7684\u53ef\u898b\u6027\u3002<\/li>\n<li><strong>\u4fc3\u9032\u92b7\u552e\uff1a<\/strong>\u5728 WooCommerce \u4e2d\uff0c\u5c07\u7279\u5b9a\u7522\u54c1\u6216\u4fc3\u92b7\u6d3b\u52d5\u7684\u6587\u7ae0\u653e\u5728\u524d\u9762\uff0c\u53ef\u4ee5\u6709\u6548\u5438\u5f15\u9867\u5ba2\u7684\u6ce8\u610f\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-wordpress-%e4%b8%ad%e9%87%8d%e6%96%b0%e6%8e%92%e5%ba%8f%e6%96%87%e7%ab%a0-JhzaOoyEBU\">\u5982\u4f55\u5728 WordPress \u4e2d\u91cd\u65b0\u6392\u5e8f\u6587\u7ae0<\/h2>\n<h3 id=\"%e4%bd%bf%e7%94%a8%e6%8b%96%e6%94%be%e5%8a%9f%e8%83%bd-JhzaOoyEBU\">\u4f7f\u7528\u62d6\u653e\u529f\u80fd<\/h3>\n<p>WordPress \u63d0\u4f9b\u4e86\u4e00\u500b\u7c21\u55ae\u7684\u62d6\u653e\u529f\u80fd\u4f86\u91cd\u65b0\u6392\u5e8f\u6587\u7ae0\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u767b\u9304\u5230\u60a8\u7684 WordPress \u5f8c\u53f0\u3002<\/li>\n<li>\u5c0e\u822a\u5230 <strong>\u6587\u7ae0<\/strong> &gt; <strong>\u6240\u6709\u6587\u7ae0<\/strong>\u3002<\/li>\n<li>\u5728\u6587\u7ae0\u5217\u8868\u4e2d\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u62d6\u52d5\u6587\u7ae0\u5230\u60a8\u60f3\u8981\u7684\u4f4d\u7f6e\u3002<\/li>\n<li>\u5b8c\u6210\u5f8c\uff0c\u7cfb\u7d71\u6703\u81ea\u52d5\u4fdd\u5b58\u60a8\u7684\u66f4\u6539\u3002<\/li>\n<\/ol>\n<h3 id=\"%e4%bd%bf%e7%94%a8%e6%8f%92%e4%bb%b6-JhzaOoyEBU\">\u4f7f\u7528\u63d2\u4ef6<\/h3>\n<p>\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u7d1a\u7684\u6392\u5e8f\u529f\u80fd\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528\u63d2\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u63a8\u85a6\u7684\u63d2\u4ef6\uff1a<\/p>\n<ul>\n<li><strong>Post Types Order\uff1a<\/strong>\u9019\u500b\u63d2\u4ef6\u5141\u8a31\u60a8\u4f7f\u7528\u62d6\u653e\u529f\u80fd\u4f86\u91cd\u65b0\u6392\u5e8f\u4efb\u4f55\u81ea\u5b9a\u7fa9\u6587\u7ae0\u985e\u578b\u3002<\/li>\n<li><strong>Simple Custom Post Order\uff1a<\/strong>\u9019\u662f\u4e00\u500b\u8f15\u91cf\u7d1a\u7684\u63d2\u4ef6\uff0c\u652f\u6301\u81ea\u5b9a\u7fa9\u6587\u7ae0\u985e\u578b\u7684\u6392\u5e8f\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8-woocommerce-%e4%b8%ad%e9%87%8d%e6%96%b0%e6%8e%92%e5%ba%8f%e7%94%a2%e5%93%81-JhzaOoyEBU\">\u5982\u4f55\u5728 WooCommerce \u4e2d\u91cd\u65b0\u6392\u5e8f\u7522\u54c1<\/h2>\n<h3 id=\"%e4%bd%bf%e7%94%a8-woocommerce-%e7%9a%84%e5%85%a7%e5%bb%ba%e5%8a%9f%e8%83%bd-JhzaOoyEBU\">\u4f7f\u7528 WooCommerce \u7684\u5167\u5efa\u529f\u80fd<\/h3>\n<p>WooCommerce \u4e5f\u63d0\u4f9b\u4e86\u5167\u5efa\u7684\u7522\u54c1\u6392\u5e8f\u529f\u80fd\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u767b\u9304\u5230\u60a8\u7684 WordPress \u5f8c\u53f0\u3002<\/li>\n<li>\u5c0e\u822a\u5230 <strong>\u7522\u54c1<\/strong> &gt; <strong>\u6240\u6709\u7522\u54c1<\/strong>\u3002<\/li>\n<li>\u5728\u7522\u54c1\u5217\u8868\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u62d6\u653e\u529f\u80fd\u4f86\u91cd\u65b0\u6392\u5e8f\u7522\u54c1\u3002<\/li>\n<li>\u5b8c\u6210\u5f8c\uff0c\u7cfb\u7d71\u6703\u81ea\u52d5\u4fdd\u5b58\u60a8\u7684\u66f4\u6539\u3002<\/li>\n<\/ol>\n<h3 id=\"%e4%bd%bf%e7%94%a8%e8%87%aa%e5%ae%9a%e7%be%a9%e6%8e%92%e5%ba%8f-JhzaOoyEBU\">\u4f7f\u7528\u81ea\u5b9a\u7fa9\u6392\u5e8f<\/h3>\n<p>\u5982\u679c\u60a8\u9700\u8981\u66f4\u9748\u6d3b\u7684\u6392\u5e8f\u9078\u9805\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528\u81ea\u5b9a\u7fa9\u6392\u5e8f\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u4ee3\u78bc\u793a\u4f8b\uff0c\u60a8\u53ef\u4ee5\u5c07\u5176\u6dfb\u52a0\u5230\u4e3b\u984c\u7684 functions.php \u6587\u4ef6\u4e2d\uff1a<\/p>\n<pre><code>\nfunction custom_product_order($query) {\n    if (!is_admin() &amp;&amp; $query-&gt;is_main_query() &amp;&amp; is_shop()) {\n        $query-&gt;set('orderby', 'menu_order');\n        $query-&gt;set('order', 'ASC');\n    }\n}\nadd_action('pre_get_posts', 'custom_product_order');\n<\/code><\/pre>\n<p>\u9019\u6bb5\u4ee3\u78bc\u5c07\u5728 WooCommerce \u5546\u5e97\u9801\u9762\u4e0a\u6839\u64da\u7522\u54c1\u7684\u83dc\u55ae\u9806\u5e8f\u9032\u884c\u6392\u5e8f\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-JhzaOoyEBU\">\u7e3d\u7d50<\/h2>\n<p>\u91cd\u65b0\u6392\u5e8f WordPress \u548c WooCommerce \u4e2d\u7684\u6587\u7ae0\u548c\u7522\u54c1\u662f\u4e00\u500b\u7c21\u55ae\u4f46\u6709\u6548\u7684\u7ba1\u7406\u7b56\u7565\u3002\u7121\u8ad6\u662f\u4f7f\u7528\u5167\u5efa\u7684\u62d6\u653e\u529f\u80fd\u9084\u662f\u5b89\u88dd\u63d2\u4ef6\uff0c\u60a8\u90fd\u53ef\u4ee5\u8f15\u9b06\u5730\u6839\u64da\u9700\u8981\u8abf\u6574\u5167\u5bb9\u7684\u986f\u793a\u9806\u5e8f\u3002\u9019\u4e0d\u50c5\u80fd\u63d0\u5347\u7528\u6236\u9ad4\u9a57\uff0c\u9084\u80fd\u589e\u5f37\u7db2\u7ad9\u7684 SEO \u6548\u679c\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u652f\u6301\u60a8\u7684 WordPress \u548c WooCommerce \u7db2\u7ad9\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u3002\u7121\u8ad6\u662f\u5c0f\u578b\u5546\u696d\u7db2\u7ad9\u9084\u662f\u5927\u578b\u96fb\u5b50\u5546\u52d9\u5e73\u53f0\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u4e91\u670d\u52a1\u5668<\/a> \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u5f37\u5927\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728 WordPress \u548c WooCommerce \u4e2d\u91cd\u65b0\u6392\u5e8f\u6587\u7ae0\uff0c\u63d0\u5347\u7db2\u7ad9\u7ba1\u7406\u6548\u7387\uff0c\u512a\u5316\u7528\u6236\u9ad4\u9a57\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-56201","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=56201"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56201\/revisions"}],"predecessor-version":[{"id":56202,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56201\/revisions\/56202"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=56201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=56201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=56201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}