{"id":29063,"date":"2024-11-25T12:41:52","date_gmt":"2024-11-25T04:41:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29063\/"},"modified":"2024-11-25T12:41:52","modified_gmt":"2024-11-25T04:41:52","slug":"wordpress%e5%a6%82%e4%bd%95%e5%9c%a8%e4%b8%80%e4%b8%aa%e9%a1%b5%e9%9d%a2%e6%98%be%e7%a4%ba%e6%89%80%e6%9c%89%e6%96%87%e7%ab%a0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29063\/","title":{"rendered":"wordpress\u5982\u4f55\u5728\u4e00\u4e2a\u9875\u9762\u663e\u793a\u6240\u6709\u6587\u7ae0"},"content":{"rendered":"<p><strong><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/037\/5d42546a772ce768.jpg\" class=\"aligncenter\" title=\"wordpress\u5982\u4f55\u5728\u4e00\u4e2a\u9875\u9762\u663e\u793a\u6240\u6709\u6587\u7ae0\u63d2\u56fe\" alt=\"wordpress\u5982\u4f55\u5728\u4e00\u4e2a\u9875\u9762\u663e\u793a\u6240\u6709\u6587\u7ae0\u63d2\u56fe\" \/><\/strong><\/p>\n<p><strong>\u8ba9WordPress\u4e00\u4e2a\u9875\u9762\u663e\u793a\u5168\u90e8\u5206\u7c7b\u7684\u6587\u7ae0<\/strong><\/p>\n<p>1\u3001\u590d\u5236\u4e00\u4e2apage.php\u6587\u4ef6\u6539\u4e3apage-abc.php\uff0c\u5e76\u5728WordPress\u540e\u53f0\u65b0\u5efa\u4e00\u4e2a\u9875\u9762\uff0c\u56fa\u5b9a\u94fe\u63a5\u5730\u5740\u6539\u4e3aabc\uff08\u8fd9\u4e2aabc\u53ef\u968f\u610f\uff0c\u4f46\u5fc5\u987b\u8ddfpage-abc\u76f8\u5bf9\u5e94\uff09\u3002<\/p>\n<p>2\u3001\u5728\u8fd9\u4e2apage-abc.php\u6587\u4ef6\u4e2d\u627e\u5230\u4ee5\u4e0b\u4ee3\u7801&nbsp; &nbsp;<\/p>\n<pre>&lt;?php  the_content(); ?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5e76\u5728\u8be5\u4ee3\u7801\u540e\u9762\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801&nbsp;&nbsp;<\/p>\n<pre>&lt;?php     $cats = get_categories();\n    foreach ( $cats as $cat ) {\n    query_posts( &#039;showposts=10&amp;cat=&#039; . $cat-&gt;cat_ID&nbsp;);\n?&amp;gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;h3&gt;\n&lt;?php  echo $cat-&gt;cat_name;&nbsp;?&amp;gt;&lt;\/h3&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/p>\n<li><\/li>\n<p> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;\n<\/ul>\n<p>\u8bb0\u5f97\u4fdd\u5b58\u66f4\u65b0page-abc.php\u6587\u4ef6\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u5237\u65b0\u4e00\u4e0b\u521a\u624d\u65b0\u5efa\u7684\u8fd9\u4e2aabc\u9875\u9762\u770b\u770b\u662f\u5426\u5df2\u7ecf\u663e\u793a\u5168\u90e8\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\u4e86\uff1f\u4ee5\u4e0a\u4ee3\u7801\u9ed8\u8ba4\u663e\u793a\u6bcf\u4e2a\u5206\u7c7b\u768410\u7bc7\u6587\u7ae0\uff0c\u5982\u679c\u9700\u8981\u663e\u793a\u6240\u6709\u6587\u7ae0\uff0c\u53ea\u9700\u8981\u628a\u4ee3\u7801\u4e2d\u768410\u6539\u4e3a1000\u6216\u66f4\u5927\u7684\u6570\u503c\u5373\u53ef\u3002<\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a\u300a\/&#8221; target=&#8221;_blank&#8221;&gt;WordPress\u6559\u7a0b\u300b<\/p>\n<p><strong>\u8ba9WordPress\u4e00\u4e2a\u9875\u9762\u663e\u793a\u51e0\u4e2a\u5206\u7c7b\u7684\u6587\u7ae0<\/strong><\/p>\n<p>\u8fd9\u4e2a\u663e\u793a\u51e0\u4e2a\u5206\u7c7b\u7684\u6587\u7ae0\u7684\u5b9e\u73b0\u65b9\u6cd5\u8ddf\u663e\u793a\u6240\u6709\u5206\u7c7b\u6587\u7ae0\u7684\u65b9\u6cd5\u662f\u4e00\u6837\u7684\uff0c\u53ea\u9700\u8981\u5c06\u7b2c2\u6b65\u4e2d\u7684\u4ee3\u7801&nbsp; &nbsp;<\/p>\n<pre>$cats&nbsp;=&nbsp;get_categories();<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6539\u4e3a<\/p>\n<pre>$cats&nbsp;=&nbsp;get_categories(array('include'&nbsp;=&amp;gt;&nbsp;'1,2,3'));<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5373\u53ef\uff0c\u5176\u4e2d1,2,3\u5c31\u662f\u60f3\u8981\u663e\u793a\u7684\u5206\u7c7bID\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728\u4e00\u4e2a\u9875\u9762\u663e\u793a\u6240\u6709\u6587\u7ae0\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8ba9WordPress\u4e00\u4e2a\u9875\u9762\u663e\u793a\u5168\u90e8\u5206\u7c7b\u7684\u6587\u7ae0 1\u3001\u590d\u5236\u4e00\u4e2apage.php\u6587\u4ef6\u6539\u4e3apage-abc.php\uff0c\u5e76\u5728WordPress\u540e\u53f0\u65b0\u5efa\u4e00\u4e2a\u9875\u9762\uff0c\u56fa\u5b9a\u94fe\u63a5\u5730\u5740\u6539\u4e3aabc\uff08\u8fd9\u4e2aabc\u53ef\u968f\u610f\uff0c\u4f46\u5fc5\u987b\u8ddfpage-abc\u76f8\u5bf9\u5e94\uff09\u3002 2\u3001\u5728\u8fd9\u4e2apage-abc.php\u6587\u4ef6\u4e2d\u627e\u5230\u4ee5\u4e0b\u4ee3\u7801&nbsp; &nbsp; &lt;?php the_content(); ?&gt; \u767b\u5f55\u540e\u590d\u5236 \u5e76\u5728\u8be5\u4ee3\u7801\u540e\u9762\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801&nbsp;&nbsp; &lt;?php $cats = get_categories(); foreach ( $cats as $cat ) { query_posts( &#039;showposts=10&amp;cat=&#039; . $cat-&gt;cat_ID&nbsp;); ?&amp;gt; &nbsp;&nbsp;&nbsp;&nbsp;&lt;h3&gt; &lt;?php echo $cat-&gt;cat_name;&nbsp;?&amp;gt;&lt;\/h3&gt; &nbsp;&nbsp;&nbsp;&nbsp; \u767b\u5f55\u540e\u590d\u5236 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; \u8bb0\u5f97\u4fdd\u5b58\u66f4\u65b0page-abc.php\u6587\u4ef6\u3002 \u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u5237\u65b0\u4e00\u4e0b\u521a\u624d\u65b0\u5efa\u7684\u8fd9\u4e2aabc\u9875\u9762\u770b\u770b\u662f\u5426\u5df2\u7ecf\u663e\u793a\u5168\u90e8\u5206\u7c7b\u4e0b\u7684\u6587\u7ae0\u4e86\uff1f\u4ee5\u4e0a\u4ee3\u7801\u9ed8\u8ba4\u663e\u793a\u6bcf\u4e2a\u5206\u7c7b\u768410\u7bc7\u6587\u7ae0\uff0c\u5982\u679c\u9700\u8981\u663e\u793a\u6240\u6709\u6587\u7ae0\uff0c\u53ea\u9700\u8981\u628a\u4ee3\u7801\u4e2d\u768410\u6539\u4e3a1000\u6216\u66f4\u5927\u7684\u6570\u503c\u5373\u53ef\u3002 \u76f8\u5173\u63a8\u8350\uff1a\u300a\/&#8221; target=&#8221;_blank&#8221;&gt;WordPress\u6559\u7a0b\u300b \u8ba9WordPress\u4e00\u4e2a\u9875\u9762\u663e\u793a\u51e0\u4e2a\u5206\u7c7b\u7684\u6587\u7ae0 \u8fd9\u4e2a\u663e\u793a\u51e0\u4e2a\u5206\u7c7b\u7684\u6587\u7ae0\u7684\u5b9e\u73b0\u65b9\u6cd5\u8ddf\u663e\u793a\u6240\u6709\u5206\u7c7b\u6587\u7ae0\u7684\u65b9\u6cd5\u662f\u4e00\u6837\u7684\uff0c\u53ea\u9700\u8981\u5c06\u7b2c2\u6b65\u4e2d\u7684\u4ee3\u7801&nbsp; &nbsp; $cats&nbsp;=&nbsp;get_categories(); \u767b\u5f55\u540e\u590d\u5236 \u6539\u4e3a $cats&nbsp;=&nbsp;get_categories(array(&#8216;include&#8217;&nbsp;=&amp;gt;&nbsp;&#8216;1,2,3&#8217;)); \u767b\u5f55\u540e\u590d\u5236 \u5373\u53ef\uff0c\u5176\u4e2d1,2,3\u5c31\u662f\u60f3\u8981\u663e\u793a\u7684\u5206\u7c7bID\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728\u4e00\u4e2a\u9875\u9762\u663e\u793a\u6240\u6709\u6587\u7ae0\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-29063","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29063","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=29063"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29063\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}