{"id":297095,"date":"2018-09-15T22:22:18","date_gmt":"2018-09-15T19:22:18","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%b2%d1%8b%d0%b2%d0%be%d0%b4-%d0%b7%d0%b0%d0%bf%d0%b8%d1%81%d0%b5%d0%b9-%d0%bf%d0%be-%d0%ba%d0%b0%d1%82%d0%b5%d0%b3%d0%be%d1%80%d0%b8%d1%8f%d0%bc\/"},"modified":"2018-09-15T22:25:39","modified_gmt":"2018-09-15T19:25:39","slug":"%d0%b2%d1%8b%d0%b2%d0%be%d0%b4-%d0%b7%d0%b0%d0%bf%d0%b8%d1%81%d0%b5%d0%b9-%d0%bf%d0%be-%d0%ba%d0%b0%d1%82%d0%b5%d0%b3%d0%be%d1%80%d0%b8%d1%8f%d0%bc","status":"publish","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%b2%d1%8b%d0%b2%d0%be%d0%b4-%d0%b7%d0%b0%d0%bf%d0%b8%d1%81%d0%b5%d0%b9-%d0%bf%d0%be-%d0%ba%d0%b0%d1%82%d0%b5%d0%b3%d0%be%d1%80%d0%b8%d1%8f%d0%bc\/","title":{"rendered":"\u0412\u044b\u0432\u043e\u0434 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c"},"content":{"rendered":"<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430:<\/p>\n<p>\u041d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u044b. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u044b \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0440\u0443\u0431\u0440\u0438\u043a\u0438 \u043f\u043e\u0441\u0442\u043e\u0432.<br \/>\n\u0421\u043e\u0437\u0434\u0430\u043b \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u0441\u0442\u043e\u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u044b.<\/p>\n<p>\u0413\u0434\u0435-\u0442\u043e \u0447\u0438\u0442\u0430\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u0430 \u043f\u043e\u0441\u0442\u043e\u0432 \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 tax_query (\u043c\u043e\u0436\u0435\u0442 \u044f \u043d\u0435 \u043f\u0440\u0430\u0432). \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0442\u0430\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 tax_query, \u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0438\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u043c\u043e\u0435\u043c \u043a\u043e\u0434\u0435.<\/p>\n<p>\u041a\u043e\u0434:<\/p>\n<pre><code>&lt;?php \n$arg_cat = array(\n&#039;orderby&#039;      =&gt; &#039;name&#039;,\n&#039;order&#039;        =&gt; &#039;ASC&#039;,\n&#039;hide_empty&#039;   =&gt; 1,\n&#039;include&#039;      =&gt; &#039;&#039;,\n&#039;taxonomy&#039;     =&gt; &#039;gallery_category&#039;,\n  &#039;post_status&#039; =&gt; &#039;publish&#039;\n);\n$categories = get_categories( $arg_cat );\n?&gt;\n&lt;?php get_header(); ?&gt;\n  &lt;div class=&quot;container&quot;&gt;\n    &lt;div class=&quot;wrapper&quot;&gt;\n  \n    &lt;?php \n      if( $categories ){\n        foreach( $categories as $cat ){\n          $arg_posts =  array(\n          &#039;orderby&#039;      =&gt; &#039;name&#039;,\n          &#039;order&#039;        =&gt; &#039;ASC&#039;,\n          &#039;post_type&#039; =&gt; &#039;gallery&#039;,\n          &#039;cat&#039; =&gt; $cat-&gt;cat_ID,\n        );\n      $query = new WP_Query($arg_posts);\n    ?&gt;\n      &lt;?php if ($query-&gt;have_posts() ) ?&gt;\n      &lt;h2&gt;&lt;?php echo $cat-&gt;name; ?&gt; &lt;\/h2&gt;\n\n      &lt;div class=&quot;gallery-wrap&quot;&gt;\n        &lt;div class=&quot;owl-carousel gal&quot;&gt;\n          &lt;?php while ( $query-&gt;have_posts() ) : $query-&gt;the_post(); ?&gt;\n            &lt;div class=&quot;slide&quot; style=&quot;background-image: url(&lt;?php echo get_the_post_thumbnail_url( $query-&gt;ID, &#039;large&#039;); ?&gt;);&quot;&gt;&lt;\/div&gt;\n\n            &lt;?php endwhile; wp_reset_postdata()?&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n  \n&lt;?php\t\t\n}\n}\n?&gt;\n      &lt;\/div&gt;\n        &lt;\/div&gt;<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0431\u044b\u043b\u0430 category, \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u043d\u0430 gallery_category&#8217;. \u0412 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430?<\/p>\n","protected":false},"template":"","class_list":["post-297095","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/297095","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":3,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/297095\/revisions"}],"predecessor-version":[{"id":297098,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/297095\/revisions\/297098"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=297095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}