{"id":753,"date":"2012-01-24T18:05:18","date_gmt":"2012-01-24T16:05:18","guid":{"rendered":"http:\/\/www.kavdesign.net\/blog\/?p=753"},"modified":"2012-01-24T18:12:09","modified_gmt":"2012-01-24T16:12:09","slug":"how-to-display-an-archive-with-all-postst","status":"publish","type":"post","link":"https:\/\/www.kavdesign.net\/blog\/wordpress\/how-to-display-an-archive-with-all-postst\/","title":{"rendered":"How to display an archive with all postst in WordPress?"},"content":{"rendered":"<p>To do this add another page template in your theme&#8217;s folder.<\/p>\n<p>You could create a Page (Write &gt; Write Page) called&#8230;,\u00a0 that just uses a <a href=\"http:\/\/codex.wordpress.org\/Pages#Creating_your_own_Page_Templates\">custom Page template <\/a> implementing query_posts().<\/p>\n<p>I do something similar on my site but don&#8217;t list every post! Just the categories with description and such. However, one can combine the idea of a Category Page with what I do on my &#8216;Archive&#8217; Page:<\/p>\n<p>Sometimes the\u00a0 function wp_query(); brakes the pagination, so if this hapens use this code insted:<\/p>\n<pre><code>&lt;?php $limit = get_option('posts_per_page'); \r\n$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; \r\nquery_posts('showposts=' . $limit . '&amp;paged=' . $paged); \r\n$wp_query-&gt;is_archive = true; \r\n$wp_query-&gt;is_home = false; ?&gt;<\/code><\/pre>\n<p>Notes:<\/p>\n<p><code>$limit<\/code> is assigned the &#8216;posts_per_page&#8217; option from your WordPress settings, but can be changed to something else if you like:<\/p>\n<p><code>$limit = 20;<\/code><\/p>\n<p>These:<\/p>\n<pre><code>$wp_query-&gt;is_archive = true; $wp_query-&gt;is_home = false;<\/code><\/pre>\n<p>after the query_posts() are important as they force posts_nav_link() (and so pagination) to work, along with a few other helpful results gained for fooling WordPress into thinking we&#8217;re in the archive pages.<\/p>\n<p>For the $paged stuff, see:<br \/>\n<a href=\"http:\/\/wordpress.org\/support\/topic\/57912#post-312858\" rel=\"nofollow\">http:\/\/wordpress.org\/support\/topic\/57912#post-312858<\/a><\/p>\n<p><em>For more info: http:\/\/wordpress.org\/support\/topic\/querying-all-posts<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To do this add another page template in your theme&#8217;s folder. You could create a Page (Write &gt; Write Page) called&#8230;,\u00a0 that just uses a&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.kavdesign.net\/blog\/wordpress\/how-to-display-an-archive-with-all-postst\/\">Continue reading<span class=\"screen-reader-text\">How to display an archive with all postst in WordPress?<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[82],"tags":[235,236,418,237],"class_list":["post-753","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-archive","tag-posts","tag-wordpress","tag-wp_query","entry"],"_links":{"self":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts\/753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/comments?post=753"}],"version-history":[{"count":7,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts\/753\/revisions"}],"predecessor-version":[{"id":760,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/posts\/753\/revisions\/760"}],"wp:attachment":[{"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/media?parent=753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/categories?post=753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kavdesign.net\/blog\/wp-json\/wp\/v2\/tags?post=753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}