{"id":211392,"date":"2016-06-02T19:48:53","date_gmt":"2016-06-02T19:48:53","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/2016\/06\/02\/%d0%a4%d0%b8%d0%bb%d1%8c%d1%82%d1%80-add_filter-%d1%81%d1%80%d0%b0%d0%b1%d0%b0%d1%82%d1%8b%d0%b2%d0%b0%d0%b5%d1%82-%d1%82%d0%be%d0%bb%d1%8c%d0%ba%d0%be-%d0%be%d0%b4%d0%b8%d0%bd-%d1%80%d0%b0%d0%b7\/"},"modified":"2016-06-02T19:48:53","modified_gmt":"2016-06-02T19:48:53","slug":"%d0%a4%d0%b8%d0%bb%d1%8c%d1%82%d1%80-add_filter-%d1%81%d1%80%d0%b0%d0%b1%d0%b0%d1%82%d1%8b%d0%b2%d0%b0%d0%b5%d1%82-%d1%82%d0%be%d0%bb%d1%8c%d0%ba%d0%be-%d0%be%d0%b4%d0%b8%d0%bd-%d1%80%d0%b0%d0%b7","status":"publish","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%a4%d0%b8%d0%bb%d1%8c%d1%82%d1%80-add_filter-%d1%81%d1%80%d0%b0%d0%b1%d0%b0%d1%82%d1%8b%d0%b2%d0%b0%d0%b5%d1%82-%d1%82%d0%be%d0%bb%d1%8c%d0%ba%d0%be-%d0%be%d0%b4%d0%b8%d0%bd-%d1%80%d0%b0%d0%b7\/","title":{"rendered":"\u0424\u0438\u043b\u044c\u0442\u0440 add_filter \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437"},"content":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0432\u0441\u0435\u0445 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e \u0434\u0432\u0430 \u0440\u0430\u0437\u0430. \u041f\u0435\u0440\u0432\u043e\u0435 \u0432\u0438\u0434\u043d\u043e \u0441\u0440\u0430\u0437\u0443, \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0435 \u0432\u0432\u0435\u0440\u0445, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043f\u0440\u043e\u043b\u0438\u0441\u0442\u0430\u043b \u0432\u043d\u0438\u0437. \u0412\u0442\u043e\u0440\u043e\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0432\u0438\u0434\u043d\u043e, \u043d\u043e \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0430. \u0412\u043e\u0442 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<pre><code>&lt;?php wp_nav_menu( array(\n   &#039;theme_location&#039; =&gt; &#039;main-menu&#039;,\n   &#039;container&#039; =&gt; &#039;div&#039;,\n   &#039;container_class&#039; =&gt; &#039;main-menu&#039;,\n   &#039;container_id&#039; =&gt; &#039;nav-wrapper&#039;\n ) ); ?&gt;<\/code><\/pre>\n<pre><code>&lt;?php wp_nav_menu( array(\n   &#039;theme_location&#039; =&gt; &#039;main-menu&#039;,\n   &#039;container&#039; =&gt; &#039;div&#039;,\n   &#039;container_class&#039; =&gt; &#039;main-menu&#039;,\n   &#039;container_id&#039; =&gt; &#039;nav-wrapper-appear&#039;\n) ); ?&gt;<\/code><\/pre>\n<p>\u0438 \u0435\u0441\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440<\/p>\n<pre><code>function addNewItemMenuifNewMonth($items, $args) {\n\n$arch = wp_get_archives( array( &#039;type&#039; =&gt; &#039;monthly&#039;, format&#039;=&gt;&#039;html&#039;, &#039;echo&#039; =&gt; false ) );\n\n\tglobal $wpdb, $month;\n\n\t$years =  $wpdb-&gt;get_col(&quot;SELECT DISTINCT DATE_FORMAT(post_date_gmt, &#039;%Y&#039;)\n\tFROM $wpdb-&gt;posts\n\tWHERE post_type = &#039;post&#039; AND post_status = &#039;publish&#039;&quot;);\n\n\tif ( $years &amp;&amp; count($years) &gt; 0 ) {\n\t\tforeach ( $years as $y ) {\n\t\t\t$arch = str_replace($y, &quot;&quot;, $arch);\n\t\t}\n\t}\n\t$time_menu = &#039;&lt;li id=&quot;menu-item-50&quot; class=&quot;menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-50&quot;&gt;&lt;a&gt;\u0412\u0440\u0435\u043c\u044f&lt;\/a&gt;&lt;ul class=&quot;sub-menu&quot;&gt;&#039; . $arch . &#039;&lt;\/ul&gt;&lt;\/li&gt;&#039;; \n\n\treturn str_replace(&#039;&lt;li id=&quot;menu-item-50&quot; class=&quot;menu-item menu-item-type-custom menu-item-object-custom menu-item-50&quot;&gt;&lt;a&gt;\u0412\u0440\u0435\u043c\u044f&lt;\/a&gt;&lt;\/li&gt;&#039;, $time_menu, $items);\n}\n\nadd_filter(&#039;wp_nav_menu&#039;, &#039;addNewItemMenuifNewMonth&#039;, 1, 2);<\/code><\/pre>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u0435 \u043c\u0435\u043d\u044e \u044d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442, \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u0436\u0435 \u043d\u0435\u0442.. \u0412 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430?<\/p>\n","protected":false},"template":"","class_list":["post-211392","topic","type-topic","status-publish","hentry","topic-tag-add_filter","topic-tag-wp_nav_menu"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/211392","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\/211392\/revisions"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=211392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}