{"id":294535,"date":"2018-08-22T14:24:58","date_gmt":"2018-08-22T11:24:58","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%b2%d1%8b%d0%b2%d0%be%d0%b4-%d0%b2%d1%81%d0%b5%d1%85-%d0%bf%d0%be%d1%81%d1%82%d0%be%d0%b2-register-post-type-2\/"},"modified":"2018-08-22T14:24:58","modified_gmt":"2018-08-22T11:24:58","slug":"%d0%b2%d1%8b%d0%b2%d0%be%d0%b4-%d0%b2%d1%81%d0%b5%d1%85-%d0%bf%d0%be%d1%81%d1%82%d0%be%d0%b2-register-post-type-2","status":"publish","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%b2%d1%8b%d0%b2%d0%be%d0%b4-%d0%b2%d1%81%d0%b5%d1%85-%d0%bf%d0%be%d1%81%d1%82%d0%be%d0%b2-register-post-type-2\/","title":{"rendered":"\u0412\u044b\u0432\u043e\u0434 \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 (register post type)?"},"content":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>\u0422\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430.<\/p>\n<p>\u042f \u0432\u044b\u0432\u043e\u0436\u0443 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u044b \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0447\u0435\u0440\u0435\u0437 register post type \u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430 \u00ab\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0435\u00bb. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0438 \u044f \u043f\u044b\u0442\u0430\u044e\u0441\u044c \u043d\u0430 \u044d\u0442\u043e\u0439 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f 6 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0430 \u043d\u0430 \u0442\u043e\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0432\u0435\u0441\u0442\u0438\u0441\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438(\u0438\u0445 \u043e\u043a\u043e\u043b\u043e 20).<\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c?<\/p>\n<p>register post type \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f vacancies.<br \/>\n2 \u0444\u0430\u0439\u043b\u0430: vacancies-page.php &#8212; \u0442\u0443\u0442 \u0438\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u043a\u043e\u043b\u043e 6), \u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 archive-vacancies \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c (\u0431\u043e\u043b\u044c\u0448\u0435 20).<br \/>\n\u041a\u043e\u0434 vacancies-page.php<\/p>\n<pre><code>&lt;div class=&quot;vacancies&quot;&gt;\n    &lt;?php foreach(getVacancies() as $vpost): ?&gt;\n        &lt;div class=&quot;vac-card&quot;&gt;\n            &lt;div class=&quot;pic&quot; style=&quot;background-image: url(&lt;?php echo get_the_post_thumbnail_url( $vpost-&gt;ID, &#039;large&#039;); ?&gt;);&quot;&gt;&lt;\/div&gt;\n            &lt;p&gt;&lt;?php echo $vpost-&gt;post_title; ?&gt;&lt;\/p&gt;\n        &lt;\/div&gt;\n    &lt;?php endforeach; ?&gt;\n    &lt;a href=&quot;\/vse-vakansii&quot;&gt;\n        &lt;div class=&quot;wrap-button&quot;&gt;&lt;button&gt;\u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u0430\u043a\u0430\u043d\u0441\u0438\u0439&lt;\/button&gt;&lt;\/div&gt;\n    &lt;\/a&gt;\n&lt;\/div&gt;<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u044b\u0432\u043e\u0436\u0443 \u0432 \u0444\u0430\u0439\u043b\u0435 archive-vacancies.php<br \/>\n\u041a\u043e\u0434 archive-vacancies.php<\/p>\n<pre><code>&lt;div class=&quot;vacancies&quot;&gt;\n  &lt;?php \n  $args = array(\n    &#039;numberposts&#039; =&gt; 20,\n      &#039;orderby&#039;    =&gt; &#039;count&#039;,\n      &#039;order&#039;      =&gt; &#039;DESC&#039;,\n      &#039;hide_empty&#039; =&gt; false\n    );\n\n    ?&gt;\n    &lt;?php foreach(getVacancies() as $vpost): ?&gt;\n        &lt;div class=&quot;vac-card&quot;&gt;\n        \t&lt;div class=&quot;pic&quot; style=&quot;background-image: url(&lt;?php echo get_the_post_thumbnail_url( $vpost-&gt;ID, &#039;large&#039;); ?&gt;);&quot;&gt;&lt;\/div&gt;\n            &lt;p&gt;&lt;?php echo $vpost-&gt;post_title; ?&gt;&lt;\/p&gt;\n        &lt;\/div&gt;\n    &lt;?php endforeach; ?&gt;\n&lt;\/div&gt;<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-294535","topic","type-topic","status-publish","hentry","topic-tag-wordpress"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/294535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/294535\/revisions"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=294535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}