{"id":3193,"date":"2019-12-24T13:28:29","date_gmt":"2019-12-24T05:28:29","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=3193"},"modified":"2019-12-24T13:29:03","modified_gmt":"2019-12-24T05:29:03","slug":"wordpress-shou-ye-pai-chu-fen-lei","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/skill\/wordpress-shou-ye-pai-chu-fen-lei.html","title":{"rendered":"3\u4e2a\u5728WordPress\u9996\u9875\u6392\u9664\u663e\u793a\u7279\u5b9a\u5206\u7c7b\u6587\u7ae0\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u7edd\u5927\u591a\u6570\u4f7f\u7528<a title=\"WordPress\u5b89\u88c5\u6559\u7a0b_\u670d\u52a1\u5668\u73af\u5883\u914d\u7f6e\u8981\u6c42_\u5931\u8d25\u539f\u56e0\" href=\"https:\/\/blog.naibabiji.com\/an-zhuang-wordpress\">WordPress\u5b89\u88c5<\/a>\u7684\u7f51\u7ad9\uff0c\u9996\u9875\u90fd\u4f1a\u5c55\u793a\u6700\u8fd1\u66f4\u65b0\u7684\u6240\u6709\u6587\u7ae0\u3002\u800c\u51fa\u4e8e\u67d0\u4e9b\u539f\u56e0\uff0c\u6211\u4eec\u53ef\u80fd\u5e76\u4e0d\u5e0c\u671b\u6240\u6709\u5206\u7c7b\u7684\u6587\u7ae0\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u4e24\u79cd\u65b9\u6cd5\u5b9e\u73b0<strong>\u9996\u9875\u6392\u9664\u7279\u5b9a\u5206\u7c7b<\/strong>\u3002<\/p>\n<h2>\u9996\u9875\u6392\u9664\u7279\u5b9a\u5206\u7c7b\u63d2\u4ef6<\/h2>\n<p>Ultimate Category Excluder\u662f\u4e00\u6b3e\u6839\u636e\u8bbe\u7f6e\u6392\u9664\u6587\u7ae0\u5206\u7c7b\u7684<a title=\"\u67e5\u770b\u66f4\u591a\u201cWordPress\u63d2\u4ef6\u201d\u7684\u6587\u7ae0\" href=\"https:\/\/blog.naibabiji.com\/files\/wordpress-plugins\">WordPress\u63d2\u4ef6<\/a>\uff0c\u5b83\u4e0d\u5355\u5355\u652f\u6301\u4ece\u9996\u9875\u6392\u9664\u7279\u5b9a\u5206\u7c7b\u6587\u7ae0\uff0c\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u4eceTAG\u3001\u641c\u7d22\u7ed3\u679c\u3001\u5f52\u6863\u9875\u3001RSS\u91cc\u9762\u6392\u9664\u7279\u5b9a\u5206\u7c7b\uff0c\u529f\u80fd\u975e\u5e38\u5b9e\u7528\uff0c\u9002\u5408\u5c0f\u767d\u7528\u6237\u4f7f\u7528\u3002<\/p>\n<p><a href=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2019\/11\/Ultimate-Category-Excluder.png?_upt=ae43516b1573916805\"><img loading=\"lazy\" decoding=\"async\" width=\"583\" height=\"413\" class=\"aligncenter size-full wp-image-3194\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2019\/11\/Ultimate-Category-Excluder.png?_upt=ae43516b1573916805\" alt=\"Ultimate Category Excluder\" \/><\/a><\/p>\n<p>Ultimate Category Excluder\u662f\u4e00\u6b3e\u514d\u8d39\u7684WP\u63d2\u4ef6\uff0c\u4f60\u53ef\u4ee5\u4ece\u4e0b\u9762\u94fe\u63a5\u4e0b\u8f7d\u540e\u5b89\u88c5\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4ece\u540e\u53f0\u641c\u7d22\u5b89\u88c5\u3002<\/p>\n<p><a class=\"theme-demo\" href=\"https:\/\/wordpress.org\/plugins\/ultimate-category-excluder\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u4e0b\u8f7d\u5730\u5740<\/a><\/p>\n<h2>\u4f7f\u7528\u4ee3\u7801\u6392\u9664\u5206\u7c7b<\/h2>\n<p>\u5982\u679c\u4f60\u4e0d\u60f3\u4e3a\u4e86\u6392\u9664\u5206\u7c7b\u6587\u7ae0\u5355\u72ec\u5b89\u88c5\u4e00\u4e2a\u63d2\u4ef6\uff0c\u90a3\u4e48\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4ee3\u7801\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u5177\u4f53\u65b9\u6cd5\u662f\u628a\u4e0b\u9762\u8fd9\u4e32\u4ee3\u7801\u590d\u5236\u5230\u4f60<a href=\"https:\/\/blog.naibabiji.com\/tutorial\/wordpress-code-snippets.html\">\u4e3b\u9898\u7684\u51fd\u6570\u6587\u4ef6<\/a>\u91cc\u9762\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<pre title=\"\">function exclude_category_home( $query ) {\r\nif ( $query-&gt;is_home ) {\r\n$query-&gt;set( 'cat', '-5' );\r\n}\r\nreturn $query;\r\n}\r\n\r\nadd_filter( 'pre_get_posts', 'exclude_category_home' );<\/pre>\n<p>\u4e0a\u9762\u4ee3\u7801\u4e2d\u7b2c\u4e8c\u884c\u662f\u5224\u65ad\u9875\u9762\u7684\uff0cis_home\u662f\u9996\u9875\uff0cis_search\u5c31\u662f\u641c\u7d22\u7ed3\u679c\u9875\uff0c\u5982\u679c\u4f60\u60f3\u5176\u4ed6\u9875\u9762\uff0c\u4e5f\u53ef\u4ee5\u4fee\u6539\u4ee3\u7801\u5b9e\u73b0\u3002<\/p>\n<p>\u7b2c\u4e09\u884c\u7684-5\u662f\u4ee3\u8868\u5c4f\u853d\u5206\u7c7bID\u4e3a5\u7684\u6240\u6709\u6587\u7ae0\u3002<\/p>\n<p>\u5206\u7c7bID\u4f60\u53ef\u4ee5\u901a\u8fc7\u9f20\u6807\u79fb\u52a8\u5230\u5206\u7c7b\u76ee\u5f55\u4e0a\u9762\u4ece\u94fe\u63a5\u7f51\u5740\u91cc\u9762\u63d0\u53d6\u3002<\/p>\n<p>\u5982\u679c\u8981\u6392\u9664\u591a\u4e2a\u5206\u7c7b\uff0c\u5c31\u7528\u9017\u53f7\u628a\u5206\u7c7b\u9694\u5f00\u5373\u53ef\u3002\u4f8b\u5982&#8217;-5 , -1&#8242;<\/p>\n<p><strong>\u9996\u9875\u662f\u9759\u6001\u9875\u9762\uff0c\u5982\u4f55\u5728\u535a\u5ba2\u5f52\u6863\u9875\u6392\u9664\u5206\u7c7b\u6587\u7ae0\uff1f<\/strong><\/p>\n<p>\u5976\u7238\u5efa\u7ad9\u7b14\u8bb0\u76ee\u524d\u5c31\u662f\u8bbe\u7f6e\u7684\u4e00\u4e2a\u9759\u6001\u9875\u9762\u4e3a\u9996\u9875\uff0c\u7136\u540e\u535a\u5ba2\u6587\u7ae0\u7528\u7684\u53e6\u5916\u4e00\u4e2a\u9875\u9762\u8c03\u7528\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u4e0a\u9762\u7684\u4ee3\u7801\u4f1a\u9020\u6210\u9996\u9875\u548c\u535a\u5ba2\u9875\u90fd\u4e0d\u663e\u793a\u90a3\u4e2a\u6392\u9664\u7684\u5206\u7c7b\u5185\u5bb9\u3002<\/p>\n<p>\u60f3\u8981\u53ea\u5728\u9996\u9875\u6392\u9664\uff0c\u535a\u5ba2\u5f52\u6863\u9875\u4e0d\u6392\u9664\u5206\u7c7b\uff0c\u5c31\u81ea\u5df1\u7f16\u8f91\u7f51\u7ad9\u4e3b\u9898\u6587\u4ef6\uff08\u6211\u7684\u662findex.php\uff09\u63d2\u5165\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n<pre>&lt;?php if ( have_posts() ) : query_posts($query_string .'&amp;cat=-1'); while ( have_posts() ) : the_post(); ?&gt;<\/pre>\n<p>\u4e0a\u9762\u7684\u4ee3\u7801\u53ef\u80fd\u9700\u8981\u81ea\u5df1\u6539\u9020\u4e00\u4e0b\uff0c\u67e5\u8be2\u90e8\u5206\u5c31\u662f<code>query_posts($query_string .'&amp;cat=-1');<\/code><\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;3193&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;4&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;4&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;\u7ed9\u672c\u6587\u6253\u5206 post&quot;,&quot;legend&quot;:&quot;4\\\/5 - (4 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;3\u4e2a\u5728WordPress\u9996\u9875\u6392\u9664\u663e\u793a\u7279\u5b9a\u5206\u7c7b\u6587\u7ae0\u7684\u65b9\u6cd5&quot;,&quot;width&quot;:&quot;110&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 110px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            4\/5 - (4 votes)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u7edd\u5927\u591a\u6570\u4f7f\u7528WordPress\u5b89\u88c5\u7684\u7f51\u7ad9\uff0c\u9996\u9875\u90fd\u4f1a\u5c55\u793a\u6700\u8fd1\u66f4\u65b0\u7684\u6240\u6709\u6587\u7ae0\u3002\u800c\u51fa\u4e8e\u67d0\u4e9b\u539f\u56e0\uff0c\u6211\u4eec\u53ef\u80fd\u5e76\u4e0d\u5e0c\u671b\u6240\u6709 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3196,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"3\u4e2a\u5728WordPress\u9996\u9875\u6392\u9664\u663e\u793a\u7279\u5b9a\u5206\u7c7b\u6587\u7ae0\u7684\u65b9\u6cd5 - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"\u7edd\u5927\u591a\u6570\u4f7f\u7528 WordPress\u5b89\u88c5 \u7684\u7f51\u7ad9\uff0c\u9996\u9875\u90fd\u4f1a\u5c55\u793a\u6700\u8fd1\u66f4\u65b0\u7684\u6240\u6709\u6587\u7ae0\u3002\u800c\u51fa\u4e8e\u67d0\u4e9b\u539f\u56e0\uff0c\u6211\u4eec\u53ef\u80fd\u5e76\u4e0d\u5e0c\u671b\u6240\u6709\u5206\u7c7b\u7684\u6587\u7ae0\uff0c\u90a3\u4e48\u4f60\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u4e24\u79cd\u65b9\u6cd5\u5b9e\u73b0 \u9996\u9875\u6392\u9664\u7279\u5b9a\u5206\u7c7b \u3002 \u9996\u9875\u6392\u9664\u7279\u5b9a\u5206\u7c7b\u63d2\u4ef6 Ultimate Category Excluder\u662f\u4e00\u6b3e\u6839\u636e\u8bbe\u7f6e\u6392\u9664\u6587\u7ae0\u5206\u7c7b\u7684 WordPress\u63d2\u4ef6 \uff0c\u5b83\u4e0d\u5355\u5355\u652f"},"footnotes":""},"categories":[142],"tags":[],"class_list":["post-3193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/3193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/comments?post=3193"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/3193\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media\/3196"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=3193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=3193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=3193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}