{"id":169,"date":"2016-06-07T20:18:55","date_gmt":"2016-06-07T20:18:55","guid":{"rendered":"http:\/\/www.3pixls.com\/blog\/?p=169"},"modified":"2016-06-07T20:18:55","modified_gmt":"2016-06-07T20:18:55","slug":"limit-the-number-of-months-displayed-by-wordpress-archives-widget","status":"publish","type":"post","link":"https:\/\/www.3pixls.com\/blog\/limit-the-number-of-months-displayed-by-wordpress-archives-widget\/","title":{"rendered":"Limit the number of months displayed by WordPress archives widget"},"content":{"rendered":"<p>There is two way to do this job<\/p>\n<p><strong>First<\/strong><\/p>\n<p>Locate and edit your themes <strong>functions.php<\/strong> file. This can either be done in the admin panel by navigating to<\/p>\n<p>you can find<\/p>\n<p><strong>Appearance -&gt; Editor -&gt; Click on functions.php file<\/strong><\/p>\n<p>or by directly editing the file which you can usually find under<\/p>\n<p><strong>wp-content\/themes\/&lt;theme name&gt;\/functions.php<\/strong><\/p>\n<p>[php]<br \/>\nfunction my_limit_archives( $args ) {<br \/>\n    $args[&#8216;limit&#8217;] = 10;<br \/>\n    return $args;<br \/>\n}<\/p>\n<p>add_filter( &#8216;widget_archives_args&#8217;, &#8216;my_limit_archives&#8217; );<br \/>\nadd_filter( &#8216;widget_archives_dropdown_args&#8217;, &#8216;my_limit_archives&#8217; );<br \/>\n[\/php]<\/p>\n<p><strong>Second<\/strong><br \/>\nDirectly add this code, where you want to show archive <\/p>\n<p>[php]<br \/>\n&lt;ul&gt;<br \/>\n&lt;?php wp_get_archives(&#8216;type=monthly&#8217;); ?&gt;<br \/>\n&lt;\/ul&gt;<\/p>\n<p>[\/php]<\/p>\n<p>[php]<br \/>\n&lt;ul&gt;<br \/>\n&lt;?php wp_get_archives(&#8216;type=monthly&amp;limit=6&#8217;); ?&gt;<br \/>\n&lt;\/ul&gt;<\/p>\n<p>[\/php]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is two way to do this job First Locate and edit your themes functions.php file. This can either be done in the admin panel by navigating to you can find Appearance -&gt; Editor -&gt; Click on functions.php file or by directly editing the file which you can usually find under wp-content\/themes\/&lt;theme name&gt;\/functions.php [php] function [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/posts\/169"}],"collection":[{"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":1,"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":170,"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions\/170"}],"wp:attachment":[{"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.3pixls.com\/blog\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}