{"id":5391,"date":"2024-12-07T09:02:57","date_gmt":"2024-12-07T09:02:57","guid":{"rendered":"https:\/\/forestgreen-jay-845795.hostingersite.com\/?p=5391"},"modified":"2024-12-09T15:18:10","modified_gmt":"2024-12-09T15:18:10","slug":"%d0%bf%d0%be%d1%81%d1%82%d1%8b-%d0%be%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d1%91%d0%bd%d0%bd%d1%8b%d1%85-%d0%ba%d0%b0%d1%82%d0%b5%d0%b3%d0%be%d1%80%d0%b8%d0%b9","status":"publish","type":"post","link":"https:\/\/newsbee.blog\/wp-tips\/2024\/12\/07\/5391\/","title":{"rendered":"\u0421\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043f\u043e\u0441\u0442\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439"},"content":{"rendered":"<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e \u0442\u0435\u043c \u0438\u043b\u0438 \u0438\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438\u0437 \u043f\u043e\u043a\u0430\u0437\u0430 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0431\u043b\u043e\u0433\u0430 \u043f\u043e\u0441\u0442\u044b (\u043e\u0442\u0440\u044b\u0432\u043a\u0438) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439. \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 WordPress, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0431\u043b\u043e\u0433\u0430. \u042f \u0437\u043d\u0430\u044e \u043e Category Excluder \u0438 Advanced Post Types Order.<\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b index.php \u0432\u0430\u0448\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 (\u0442\u0435\u043c\u044b), \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<div class=\"code-block-wrapper\" style=\"position: relative;\">\n        <button class=\"copy-button\" id=\"copy_code_block_69f97dc123196\" data-target=\"code_block_69f97dc123196\" style=\"\n            position: absolute; \n            top: 10px; \n            right: 10px; \n            background: #0073aa; \n            color: #fff; \n            border: none; \n            padding: 5px 10px; \n            cursor: pointer; \n            font-size: 12px;\n            border-radius: 5px;\">Copy<\/button><\/p>\n<pre><code id=\"code_block_69f97dc123196\">\r\n&lt;?php\r\n   $args = array(\r\n       &#039;post_type&#039; =&gt; &#039;post&#039;,\r\n       &#039;posts_per_page&#039; =&gt; get_option(&#039;posts_per_page&#039;),\r\n       &#039;category__not_in&#039; =&gt; array(3, 7) \/\/ \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 ID \u043d\u0443\u0436\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438\r\n   );\r\n   $query = new WP_Query($args);\r\n   \r\n   if ($query-&gt;have_posts()) :\r\n       while ($query-&gt;have_posts()) : $query-&gt;the_post();\r\n           \/\/ Your post display code here\r\n       endwhile;\r\n   endif;\r\n   wp_reset_postdata();\r\n   ?&gt;\r\n<\/code><\/pre>\n<\/p><\/div>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0441\u043d\u0438\u043f\u043f\u0435\u0442 \u043a \u0444\u0430\u0439\u043b\u0443 functions.php &#8212; \u043f\u0440\u043e\u0449\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u043b\u0430\u0433\u0438\u043d Code Snippets.<\/p>\n<p>\u0412\u043e\u0442 \u044d\u0442\u043e\u0442 \u0441\u043d\u0438\u043f\u043f\u0435\u0442:<\/p>\n<div class=\"code-block-wrapper\" style=\"position: relative;\">\n        <button class=\"copy-button\" id=\"copy_code_block_69f97dc1231a5\" data-target=\"code_block_69f97dc1231a5\" style=\"\n            position: absolute; \n            top: 10px; \n            right: 10px; \n            background: #0073aa; \n            color: #fff; \n            border: none; \n            padding: 5px 10px; \n            cursor: pointer; \n            font-size: 12px;\n            border-radius: 5px;\">Copy<\/button><\/p>\n<pre><code id=\"code_block_69f97dc1231a5\">\r\n  function exclude_categories_from_blog($query) {\r\n       if ($query-&gt;is_home() &amp;&amp; $query-&gt;is_main_query()) {\r\n           $query-&gt;set(&#039;category__not_in&#039;, array(3, 7)); \/\/ \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 ID \u043d\u0443\u0436\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438\r\n       }\r\n   }\r\n   add_action(&#039;pre_get_posts&#039;, &#039;exclude_categories_from_blog&#039;);\r\n<\/code><\/pre>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n <a class=\"read-more-button\" href=\"https:\/\/newsbee.blog\/wp-tips\/2024\/12\/07\/5391\/\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435<\/a>","protected":false},"author":1,"featured_media":5393,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[119,39,49],"class_list":["post-5391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippets","tag-119","tag-snippets","tag-49"],"_links":{"self":[{"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/posts\/5391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/comments?post=5391"}],"version-history":[{"count":3,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/posts\/5391\/revisions"}],"predecessor-version":[{"id":5397,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/posts\/5391\/revisions\/5397"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/media\/5393"}],"wp:attachment":[{"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/media?parent=5391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/categories?post=5391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/newsbee.blog\/wp-tips\/wp-json\/wp\/v2\/tags?post=5391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}