{"id":230326,"date":"2022-11-30T17:19:00","date_gmt":"2022-11-30T14:19:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=230326"},"modified":"2022-11-09T21:09:12","modified_gmt":"2022-11-09T18:09:12","slug":"specialni-pravila-perezapisu-ta-shabloni-storinok-u-wordpress","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/uk\/specialni-pravila-perezapisu-ta-shabloni-storinok-u-wordpress\/","title":{"rendered":"\u0421\u043f\u0435\u0446\u0456\u0430\u043b\u044c\u043d\u0456 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0442\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a \u0443 WordPress"},"content":{"rendered":"\n<p>API WordPress <strong><a href=\"https:\/\/codex.wordpress.org\/Rewrite_API\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Rewrite<\/a><\/strong> \u2014 \u043d\u0430\u0434\u0456\u0439\u043d\u0438\u0439 API, \u044f\u043a\u0449\u043e \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0438\u0442\u0438, \u0449\u043e \u0432\u0438 \u0434\u043e\u0431\u0440\u0435 \u0437\u043d\u0430\u0454\u0442\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0456 \u0432\u0438\u0440\u0430\u0437\u0438.<\/p>\n<p>\u0406, \u0447\u0435\u0441\u043d\u043e \u043a\u0430\u0436\u0443\u0447\u0438, \u043d\u0430\u0432\u0456\u0442\u044c \u044f\u043a\u0449\u043e \u0432\u0438 \u043d\u0456, \u0442\u0430\u043a\u0456 \u0456\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0438, \u044f\u043a <strong><a href=\"https:\/\/www.phpliveregex.com\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">PHP Live RegEx<\/a><\/strong>, \u0434\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442\u044c \u0434\u0443\u0436\u0435 \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u0432\u0456\u0440\u0438\u0442\u0438 \u0432\u0430\u0448 \u043a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434 \u0442\u0438\u043c, \u044f\u043a \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0439\u043e\u0433\u043e \u0443 <code>add_rewrite_rule<\/code>\u0432\u0438\u043a\u043b\u0438\u043a API.<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-163543-61e7543bc96ee.png\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-163543-61e7543bc96ee.png\" alt=\"\u0421\u043f\u0435\u0446\u0456\u0430\u043b\u044c\u043d\u0456 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0442\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a \u0443 WordPress\" ><\/a><\/p>\n<p>\u041e\u0434\u043d\u0430\u043a \u0431\u0443\u0432\u0430\u044e\u0442\u044c \u0432\u0438\u043f\u0430\u0434\u043a\u0438, \u043a\u043e\u043b\u0438 \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0438\u043d\u0438\u0442\u0438\u0441\u044f \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0456\u0457, \u043a\u043e\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438 \u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0442\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a. \u0406 \u043a\u043e\u043b\u0438 \u0446\u0435 \u0442\u0430\u043a, \u0446\u0435 \u043d\u0435 \u0437\u0430\u0432\u0436\u0434\u0438 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u044f\u043a \u0437\u0440\u043e\u0431\u0438\u0442\u0438 \u043f\u0440\u043e\u0441\u0442\u0438\u0439 \u0432\u0438\u043a\u043b\u0438\u043a \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0433\u043e \u0432\u0438\u0440\u0430\u0437\u0443.<\/p>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u0430? \u042f\u043a\u0449\u043e \u0443 \u0432\u0430\u0441 \u0454 \u043a\u0456\u043b\u044c\u043a\u0430 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a, \u044f\u043a\u0456 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0442\u044c \u043e\u0434\u0438\u043d \u0456 \u0442\u043e\u0439 \u0441\u0430\u043c\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d, \u0432\u0438 \u043d\u0435 \u0437\u0430\u0432\u0436\u0434\u0438 \u043c\u0430\u0442\u0438\u043c\u0435\u0442\u0435 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443 \u0432 \u043e\u0434\u043d\u043e\u043c\u0443 \u0456\u043d\u0434\u0435\u043a\u0441\u0456 \u0432 \u0437\u0430\u043f\u0438\u0442\u0456, \u044f\u043a\u0438\u0439 \u0432\u0438\u043a\u043e\u043d\u0443\u0454\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u0436\u043d\u0456\u0439 \u0441\u0442\u043e\u0440\u0456\u043d\u0446\u0456.<\/p>\n<p>\u0417 \u0446\u0456\u0454\u044e \u043c\u0435\u0442\u043e\u044e \u043d\u0430\u043c \u0434\u043e\u0432\u0435\u0434\u0435\u0442\u044c\u0441\u044f \u043e\u0431\u0440\u043e\u0431\u043b\u044f\u0442\u0438 \u0446\u0435 \u0434\u0435\u0449\u043e \u0456\u043d\u0448\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u043d\u0456\u0436, \u0441\u043a\u0430\u0436\u0456\u043c\u043e, \u043f\u0440\u043e\u0441\u0442\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0433\u043e \u0456\u043d\u0434\u0435\u043a\u0441\u0443 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u0457 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0438\u0442\u0456.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0456\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0442\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a<\/h2>\n<p>\u041f\u043e-\u043f\u0435\u0440\u0448\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0449\u043e \u0443 \u043d\u0430\u0441 \u0454 \u0434\u0432\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0438 (\u044f\u043a\u0456 \u043d\u0435 \u0432 \u043f\u0435\u0432\u043d\u043e\u043c\u0443 \u043f\u043e\u0440\u044f\u0434\u043a\u0443):<\/p>\n<ol>\n<li>template-alpha.php<\/li>\n<li>template-beta.php<\/li>\n<\/ol>\n<p>\u0406 \u0442\u043e\u0434\u0456, \u0441\u043a\u0430\u0436\u0456\u043c\u043e, \u043c\u0438 \u0445\u043e\u0447\u0435\u043c\u043e \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u0441\u043f\u0435\u0446\u0456\u0430\u043b\u044c\u043d\u0443 URL-\u0430\u0434\u0440\u0435\u0441\u0443 \u0434\u043b\u044f \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a, \u043a\u043e\u0436\u043d\u0430 \u0437 \u044f\u043a\u0438\u0445 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454 \u043e\u0434\u0438\u043d \u0456\u0437 \u0446\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0456\u0432.<\/p>\n<p>\u0426\u0435 \u0431\u0443\u0434\u0435 \u0440\u043e\u0437\u0434\u0456\u043b\u0435\u043d\u043e \u043d\u0430 \u0442\u0430\u043a\u0456 \u043a\u0440\u043e\u043a\u0438:<\/p>\n<ol>\n<li>\u041f\u0435\u0440\u0435\u0433\u043b\u044f\u0434\u0430\u0439\u0442\u0435 \u043f\u043e\u0432\u0456\u0434\u043e\u043c\u043b\u0435\u043d\u043d\u044f \u0432 \u0437\u0430\u043f\u0438\u0442\u0456,<\/li>\n<li>\u0417\u0431\u0435\u0440\u0456\u0433\u0430\u0439\u0442\u0435 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u044e \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0443 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u043e\u043c\u0443 \u043c\u0430\u0441\u0438\u0432\u0456,<\/li>\n<li>\u0412\u0441\u0442\u0430\u043d\u043e\u0432\u0456\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0434\u043b\u044f \u043a\u043e\u0436\u043d\u043e\u0457 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457, \u0449\u043e \u043c\u0456\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u0437\u0430\u043f\u0438\u0442.<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u0443 \u044f \u0437\u0431\u0435\u0440\u0435\u0436\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0434\u043e\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0438\u043c\u0438. \u0417\u0440\u0435\u0448\u0442\u043e\u044e, \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0456 \u0432\u0438\u0440\u0430\u0437\u0438 \u043c\u043e\u0436\u0443\u0442\u044c \u0431\u0443\u0442\u0438 \u0434\u043e\u0441\u0438\u0442\u044c \u0441\u043a\u043b\u0430\u0434\u043d\u0438\u043c\u0438 \u0434\u043b\u044f \u0434\u043e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f, \u0442\u043e\u043c\u0443 \u0441\u043f\u0440\u043e\u0431\u0438 \u0441\u043b\u0456\u0434\u0443\u0432\u0430\u0442\u0438 \u0457\u043c \u043f\u0456\u0434 \u0447\u0430\u0441 \u0440\u043e\u0431\u043e\u0442\u0438 \u0437 \u043e\u0431&#8217;\u0454\u043a\u0442\u043e\u043c \u0437\u0430\u043f\u0438\u0442\u0443, \u043a\u0456\u043b\u044c\u043a\u043e\u043c\u0430 \u043c\u0430\u0441\u0438\u0432\u0430\u043c\u0438 \u0442\u0430 \u043e\u0431\u0440\u043e\u0431\u043a\u043e\u044e \u043f\u0440\u0430\u0432\u0438\u043b \u043c\u043e\u0436\u0443\u0442\u044c \u0431\u0443\u0442\u0438 \u0437\u0430\u043d\u0430\u0434\u0442\u043e \u0432\u0430\u0436\u043a\u0438\u043c\u0438.<\/p>\n<p>\u0417 \u043e\u0433\u043b\u044f\u0434\u0443 \u043d\u0430 \u0446\u0435, \u043e\u0441\u044c \u0437\u0440\u0430\u0437\u043e\u043a \u043a\u043e\u0434\u0443, \u0440\u043e\u0437\u0431\u0438\u0442\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0456 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0445 \u0432\u0438\u0449\u0435 \u043a\u0440\u043e\u043a\u0456\u0432. \u041d\u0430\u043f\u0440\u0438\u043a\u0456\u043d\u0446\u0456 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457 \u044f \u043f\u043e\u0434\u0456\u043b\u044e\u0441\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u043c, \u044f\u043a\u0438\u0439 \u043f\u043e\u0454\u0434\u043d\u0443\u0454 \u0432\u0441\u0435 \u0440\u0430\u0437\u043e\u043c \u0443 \u043a\u0456\u043b\u044c\u043a\u0430 \u043e\u043a\u0440\u0435\u043c\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0456\u0439, \u0449\u043e\u0431 \u0432\u0438 \u043c\u043e\u0433\u043b\u0438 \u0431\u0430\u0447\u0438\u0442\u0438, \u044f\u043a \u0443\u0441\u0435 \u0446\u0435 \u043f\u043e\u0454\u0434\u043d\u0443\u0454\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0417 \u043e\u0433\u043b\u044f\u0434\u0443 \u043d\u0430 \u0446\u0435, \u043e\u0441\u044c \u044f\u043a \u0432\u043f\u043e\u0440\u0430\u0442\u0438\u0441\u044f \u0437 \u0443\u0441\u0456\u043c \u0432\u0438\u0449\u0435\u0437\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u043c.<\/p>\n<h3>1 \u0414\u043e\u0434\u0430\u0432\u0430\u043d\u043d\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443<\/h3>\n<p>\u041f\u043e-\u043f\u0435\u0440\u0448\u0435, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u0438 \u0434\u0435\u044f\u043a\u0443 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044e \u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u2019\u0454\u043a\u0442\u0430 \u0437\u0430\u043f\u0438\u0442\u0443 WordPress, \u0449\u043e\u0431 \u0437\u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0456 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438, \u0434\u043e \u044f\u043a\u0438\u0445 \u0437\u0430\u0441\u0442\u043e\u0441\u043e\u0432\u0430\u043d\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u0438 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044e <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/d80f687b25281f1ab7c9390cf56d2187#file-00-read-query-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u2019\u0454\u043a\u0442\u0430 \u0437\u0430\u043f\u0438\u0442\u0443 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443 \u0437\u043c\u0456\u043d\u043d\u0443<\/a><\/strong>. \u0426\u0435 \u0434\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u043b\u0435\u0433\u043a\u043e \u0443\u043d\u0438\u043a\u043d\u0443\u0442\u0438 \u0440\u0435\u0448\u0442\u0438 \u043a\u043e\u0434\u0443, \u044f\u043a\u0449\u043e \u043d\u0435\u043c\u0430\u0454 \u0437 \u0447\u0438\u043c \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438.<\/p>\n<pre><code>&lt;?php \n\n$query = $this-&gt;query-&gt;query([\n    'post_type' =&gt; 'page',\n    'meta_key' =&gt; '_wp_page_template',\n    'meta_value' =&gt; ['template-alpha.php', 'template-beta.php'],\n]);\n\nif (!$query) {\n    return;\n}\n\n\/\/ More to come...\n<\/code><\/pre>\n<h3>2 \u0417\u0431\u0435\u0440\u0456\u0433\u0430\u0439\u0442\u0435 \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u0443 \u0456\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0456\u044e \u0432 \u043c\u0430\u0441\u0438\u0432\u0456<\/h3>\n<p>\u042f\u043a\u0449\u043e \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0438\u0442\u0438, \u0449\u043e \u0454 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438 \u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438, \u0442\u043e \u043c\u0438 \u043f\u0440\u043e\u0434\u043e\u0432\u0436\u0438\u043c\u043e <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/d80f687b25281f1ab7c9390cf56d2187#file-001-store-templated-pages-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0442\u0438 \u043a\u043e\u0436\u043d\u0443 \u0437\u0456 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a<\/a><\/strong> \u0443 \u043c\u0430\u0441\u0438\u0432\u0430\u0445, \u0449\u043e\u0431 \u043c\u0438 \u043c\u043e\u0433\u043b\u0438 \u043b\u0435\u0433\u043a\u043e \u043a\u0435\u0440\u0443\u0432\u0430\u0442\u0438 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u0438\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443.<\/p>\n<pre><code>&lt;?php\n\nforeach ($query as $post) {\n    $slug = get_page_template_slug($post-&gt;ID);\n\n    if ('template-alpha.php' === $slug) {\n        $this-&gt;alphaPages[] = $post;\n    }\n\n    if ('template-find-a-camp.php' === $slug) {\n        $this-&gt;betaPages[] = $post;\n    }\n}\n<\/code><\/pre>\n<p>\u0417\u0430\u0443\u0432\u0430\u0436\u0442\u0435, \u0449\u043e \u0432\u0438\u0449\u0435 \u044f \u043f\u043e\u0441\u0438\u043b\u0430\u044e\u0441\u044f \u043d\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0438\u0439 \u043c\u0430\u0441\u0438\u0432. \u041f\u0440\u0438\u043f\u0443\u0441\u0442\u0456\u043c\u043e, \u0449\u043e \u0446\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0456\u043d\u0456\u0446\u0456\u0430\u043b\u0456\u0437\u043e\u0432\u0430\u043d\u043e \u044f\u043a \u043f\u043e\u0440\u043e\u0436\u043d\u0456\u0439 \u043c\u0430\u0441\u0438\u0432 \u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0456 \u043a\u043b\u0430\u0441\u0443.<\/p>\n<h3>3 \u041d\u0430\u043b\u0430\u0448\u0442\u0443\u0439\u0442\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440, \u043a\u043e\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0454 \u0434\u0432\u0430 \u043c\u0430\u0441\u0438\u0432\u0438 \u2013 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u043a\u043e\u0436\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0442\u0430 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a, \u044f\u043a\u0456 \u0439\u043e\u0433\u043e \u043c\u0456\u0441\u0442\u044f\u0442\u044c \u2013 \u043c\u0438 \u043c\u043e\u0436\u0435\u043c\u043e \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u0434\u0430\u0442\u0438 \u0457\u0445 \u0456 \u043f\u0440\u0438\u0437\u043d\u0430\u0447\u0430\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0434\u043b\u044f \u043a\u043e\u0436\u043d\u043e\u0457 \u0437 \u0446\u0438\u0445 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u043f\u0440\u0438\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0449\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443, \u0441\u043a\u0430\u0436\u0456\u043c\u043e, \u0430\u043b\u044c\u0444\u0430, \u043c\u0438 \u0445\u043e\u0447\u0435\u043c\u043e \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0434\u043b\u044f \u0421\u0428\u0410 \u0442\u0430 \u0448\u0442\u0430\u0442\u0456\u0432.<\/p>\n<p><strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/d80f687b25281f1ab7c9390cf56d2187#file-02-country-state-rules-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u041e\u0441\u044c \u043a\u043e\u0434<\/a><\/strong> \u0434\u043b\u044f<code>template-alpha.php<\/code>:<\/p>\n<pre><code>&lt;?php\n\nadd_rewrite_tag('%country%', '([^&amp;]+)');\nadd_rewrite_tag('%state%', '([^&amp;]+)');\n\nforeach ($this-&gt;alphaPages as $post) {\n    add_rewrite_rule(\n        '^'.$post-&gt;post_name.'\/([^\/]*)\/([^\/]*)\/?',\n        'index.php?page_id='.$post-&gt;ID.'&amp;country=$matches[1]&amp;state=$matches[2]',\n        'top'\n    );\n\n    add_rewrite_rule(\n        '^'.$post-&gt;post_name.'\/([^\/]*)\/?',\n        'index.php?page_id='.$post-&gt;ID.'&amp;country=$matches[1]',\n        'top'\n    );\n}\n<\/code><\/pre>\n<p>\u0406 <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/d80f687b25281f1ab7c9390cf56d2187#file-03-acme-id-rules-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043e\u0441\u044c \u043a\u043e\u0434<\/a><\/strong> \u0434\u043b\u044f <code>template-beta.php<\/code>:<\/p>\n<pre><code>&lt;?php\n\nadd_rewrite_tag('%acme-id%', '([^&amp;]+)');\n\nforeach ($this-&gt;betaPages as $post) {\n    add_rewrite_rule(\n        '^(.*)?\/([A-Za-z0-9-]+-)(d+)\/?',\n        'index.php?page_id='.$post-&gt;ID.'&amp;acme-id=$matches[3]',\n        'top'\n    );\n}\n<\/code><\/pre>\n<p>\u0417\u0432\u0438\u0447\u0430\u0439\u043d\u043e, \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0456 \u0432\u0438\u0440\u0430\u0437\u0438, \u044f\u043a\u0456 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434\u0456 \u0432\u0438\u0449\u0435, \u043f\u0440\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u0456 \u043b\u0438\u0448\u0435 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0456\u0457. \u0412\u0430\u0448\u0438\u043c \u0431\u0443\u0434\u0435 \u0432\u0441\u0435, \u0449\u043e \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0434\u043b\u044f \u0432\u0430\u0448\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443.<\/p>\n<h3>4 \u0417\u0430\u0440\u0430\u0437 \u0443\u0441\u0456 \u0440\u0430\u0437\u043e\u043c<\/h3>\n<p>\u0412\u0430\u0436\u043b\u0438\u0432\u043e \u0440\u043e\u0437\u0431\u0438\u0442\u0438 \u0432\u0441\u044e \u0446\u044e \u0444\u0443\u043d\u043a\u0446\u0456\u043e\u043d\u0430\u043b\u044c\u043d\u0456\u0441\u0442\u044c \u043d\u0430 \u0432\u043b\u0430\u0441\u043d\u0456 \u043c\u0435\u0442\u043e\u0434\u0438, \u0449\u043e\u0431 \u0443 \u0440\u0430\u0437\u0456 \u043f\u043e\u0442\u0440\u0435\u0431\u0438 \u0457\u0445 \u043c\u043e\u0436\u043d\u0430 \u0431\u0443\u043b\u043e \u043b\u0435\u0433\u043a\u043e \u0456\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044e\u0432\u0430\u0442\u0438 \u0442\u0430 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0443\u0432\u0430\u0442\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e <strong><a href=\"https:\/\/gist.github.com\/tommcfarlin\/d80f687b25281f1ab7c9390cf56d2187#file-04-final-functions-php\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043e\u0441\u044c \u044f\u043a<\/a><\/strong> \u0432\u0438\u0433\u043b\u044f\u0434\u0430\u0442\u0438\u043c\u0435 \u043f\u043e\u0432\u043d\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>&lt;?php\n\npublic function addRewriteRules()\n{\n    $query = $this-&gt;query-&gt;query([\n        'post_type' =&gt; 'page',\n        'meta_key' =&gt; '_wp_page_template',\n        'meta_value' =&gt; ['template-alpha.php', 'template-beta.php'],\n    ]);\n\n    if (!$query) {\n        return;\n    }\n\n    $this-&gt;setPageTypes($query);\n    $this-&gt;setAlphaRewriteRules();\n    $this-&gt;setBetaRewriteRules();\n}\n\nprivate function setPageTypes($query)\n{\n    foreach ($query as $post) {\n        $slug = get_page_template_slug($post-&gt;ID);\n\n        if ('template-alpha.php' === $slug) {\n            $this-&gt;alphaPages[] = $post;\n        }\n\n        if ('template-find-a-camp.php' === $slug) {\n            $this-&gt;betaPages[] = $post;\n        }\n    }\n}\n\nprivate function setAlphaRewriteRules()\n{\n    add_rewrite_tag('%country%', '([^&amp;]+)');\n    add_rewrite_tag('%state%', '([^&amp;]+)');\n\n    foreach ($this-&gt;alphaRules as $post) {\n        add_rewrite_rule(\n            '^'.$post-&gt;post_name.'\/([^\/]*)\/([^\/]*)\/?',\n            'index.php?page_id='.$post-&gt;ID.'&amp;country=$matches[1]&amp;state=$matches[2]',\n            'top'\n        );\n\n        add_rewrite_rule(\n            '^'.$post-&gt;post_name.'\/([^\/]*)\/?',\n            'index.php?page_id='.$post-&gt;ID.'&amp;country=$matches[1]',\n            'top'\n        );\n    }\n}\n\nprivate function setBetaRewriteRules()\n{\n    add_rewrite_tag('%acme-id%', '([^&amp;]+)');\n\n    foreach ($this-&gt;betaPages as $post) {\n        add_rewrite_rule(\n            '^(.*)?\/([A-Za-z0-9-]+-)(d+)\/?',\n            'index.php?page_id='.$post-&gt;ID.'&amp;acme-id=$matches[3]',\n            'top'\n        );\n    }\n}\n<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a \u043f\u0430\u043c&#8217;\u044f\u0442\u0430\u0439\u0442\u0435; \u0446\u0435 \u043b\u0438\u0448\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0456 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0456\u0439\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0443, \u043f\u043e\u0448\u0438\u0440\u0435\u043d\u043e\u0433\u043e \u0432 \u0446\u0456\u0439 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457. \u041a\u043e\u043b\u0438 \u0432\u0438 \u043f\u0440\u0430\u0446\u044e\u0454\u0442\u0435 \u043d\u0430\u0434 \u0441\u0432\u043e\u0457\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0456 \u0432\u0438\u0440\u0430\u0437\u0438, \u0448\u0430\u0431\u043b\u043e\u043d\u0438 \u0442\u043e\u0449\u043e \u0437\u043c\u0456\u043d\u044e\u0432\u0430\u0442\u0438\u043c\u0443\u0442\u044c\u0441\u044f.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/tommcfarlin.com\" class=\"external external_icon\">tommcfarlin.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0411\u0443\u0432\u0430\u044e\u0442\u044c \u0432\u0438\u043f\u0430\u0434\u043a\u0438, \u043a\u043e\u043b\u0438 \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0438\u043d\u0438\u0442\u0438\u0441\u044f \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0456\u0457, \u043a\u043e\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043f\u0440\u0430\u0446\u044e\u0432\u0430\u0442\u0438 \u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0443 \u0442\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043e\u043a.<\/p>\n","protected":false},"author":1,"featured_media":163544,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[869,902,849,725],"tags":[1174],"class_list":["post-230326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-10","category-kod-3","category-pidruchnyky","category-rozrobnyk","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/230326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/comments?post=230326"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/230326\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media\/163544"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media?parent=230326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/categories?post=230326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/tags?post=230326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}