{"id":41758,"date":"2024-11-24T14:27:34","date_gmt":"2024-11-24T12:27:34","guid":{"rendered":"https:\/\/coma.lv\/2024\/11\/24\/how-to-display-all-your-wordpress-posts-on-one-page\/"},"modified":"2024-11-24T14:27:34","modified_gmt":"2024-11-24T12:27:34","slug":"how-to-display-all-your-wordpress-posts-on-one-page","status":"publish","type":"post","link":"https:\/\/coma.lv\/en\/2024\/11\/24\/how-to-display-all-your-wordpress-posts-on-one-page\/","title":{"rendered":"How to Display All Your WordPress Posts on One Page"},"content":{"rendered":"\n<p style=\"text-align: left;\">Why and when do you need to display all posts on one page? WordPress has built-in archive pages for every category, tag, author and date. However, many site owners prefer to create custom archive pages for their sites. These pages usually highlight popular posts, show a compact date-based archive, list categories, display a tag cloud and much more.<\/p>\n<h2 style=\"text-align: left;\">Showing All WordPress Posts on One Page<\/h2>\n<p style=\"text-align: left;\">There are many different ways to display all your WordPress posts on one page. You can display posts on a page using a shortcode, using a plugin or, finally, using a custom template. We will go through all three methods in detail, starting with the easiest one for beginners.<\/p>\n<h2 style=\"text-align: left;\">Method One: Using the Display Posts Shortcode Plugin<\/h2>\n<p style=\"text-align: left;\">You need to install and activate the Display Posts Shortcode plugin. This plugin works right out of the box, and it has no parameters to configure. Create a new page and call it Archives. After that, copy the following shortcode onto your page.<\/p>\n<p style=\"text-align: left;\">[display-posts posts_per_page=&#8221;1000&#8243; order=&#8221;DESC&#8221;]<\/p>\n<p style=\"text-align: left;\">This shortcode will simply display a list of all your post titles in chronological order. It is set to display a maximum of 1,000 posts per page. If you have more than a thousand posts on your site, you can change this, just as you can change the sort order to display posts in reverse chronological order (older posts first).<\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2016\/11\/listallposts.jpg\" alt=\"WordPress\" title=\"\"><\/p>\n<p style=\"text-align: left;\">While you can use the shortcode to display thumbnails and other information related to posts, we advise against it. When you list all posts on one page, that page will be long, and you will want to keep it simple and fast. Titles alone are enough for this page. If you want to display posts based on category or other parameters, you can do so by following the instructions on the documentation page.<\/p>\n<h2 style=\"text-align: left;\">Method Two: Using the Simple Yearly Archive Plugin<\/h2>\n<p style=\"text-align: left;\">Displaying all your posts within one page can require too much scrolling. However, you can avoid this by showing a list for each year. Users can click the years to expand them and see the posts that were published in that period. To do this, first install and activate the Simple Yearly Archive plugin. After activation, go to the Settings &gt; Simple Yearly Archive page to configure the plugin&#8217;s parameters.<\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2016\/11\/simpleyearlyarchive.jpg\" alt=\"WordPress\" title=\"\"><\/p>\n<p style=\"text-align: left;\">The plugin lets you display the list of posts in a variety of ways. You can show them all under links to yearly archives, or you can show them under collapsible years. If you want to add them under collapsible years, you need to add<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\r\n&amp;lt;div&amp;gt; \u0438 &amp;lt;\/div&amp;gt;\r\n\r\n<\/pre>\n<p style=\"text-align: left;\">next to the \u2018Before \/ After (Year headline)\u2019 option. The remaining plugin settings are fairly simple. Now, to display all posts on a page, you need to add the [SimpleYearlyArchive] shortcode to a page of your choice.<\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2016\/11\/yearly-archives.jpg\" alt=\"WordPress\" title=\"\"><\/p>\n<p style=\"text-align: left;\">The plugin provides many parameters that can be used together with this shortcode. You can look at the plugin&#8217;s parameters on the documentation page.<\/p>\n<h2 style=\"text-align: left;\">Method Three: Displaying All WordPress Posts on One Page with Code<\/h2>\n<p style=\"text-align: left;\">First you need to create a custom page template and copy the style from the page.php file. After that use the following code:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&amp;lt;?php \/\/ the query $wpb_all_query = new WP_Query(array(&amp;#039;post_type&amp;#039;=&amp;gt;&amp;#039;post&amp;#039;, &amp;#039;post_status&amp;#039;=&amp;gt;&amp;#039;publish&amp;#039;, &amp;#039;posts_per_page&amp;#039;=&amp;gt;-1)); ?&amp;gt;\r\n\r\n&amp;lt;?php if ( $wpb_all_query-&amp;gt;have_posts() ) : ?&amp;gt;\r\n\r\n&amp;lt;ul&amp;gt;\r\n\r\n\t&amp;lt;!-- the loop --&amp;gt;\r\n\t&amp;lt;?php while ( $wpb_all_query-&amp;gt;have_posts() ) : $wpb_all_query-&amp;gt;the_post(); ?&amp;gt;\r\n\r\n&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&amp;lt;?php the_permalink(); ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php the_title(); ?&amp;gt;&amp;lt;\/a&amp;gt;&amp;lt;\/li&amp;gt;\r\n\r\n\t&amp;lt;?php endwhile; ?&amp;gt;\r\n\t&amp;lt;!-- end of the loop --&amp;gt;\r\n\r\n&amp;lt;\/ul&amp;gt;\r\n\r\n\t&amp;lt;?php wp_reset_postdata(); ?&amp;gt;\r\n\r\n&amp;lt;?php else : ?&amp;gt;\r\n\r\n\r\n&amp;lt;?php _e( &amp;#039;Sorry, no posts matched your criteria.&amp;#039; ); ?&amp;gt;\r\n\r\n&amp;lt;?php endif; ?&amp;gt;\r\n<\/pre>\n<p style=\"text-align: left;\">If this is too complicated for you, you can use the first method.<\/p>\n<hr \/>\n<p style=\"text-align: left;\"><em>Our specialization is WordPress website development and maintenance. Contact us for a free consultation \u2014 <a href=\"mailto:vadim@coma.lv\">vadim@coma.lv<\/a>, <a href=\"tel:+37129394520\">+371 29394520<\/a><\/em><\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>Why and when do you need to display all posts on one page? WordPress has built-in archive pages for every category, tag, author and date. However, many site owners prefer to create custom archive pages for their sites. These pages usually highlight popular posts, show a compact date-based archive, list categories, display a tag cloud [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":38126,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1225,1406],"tags":[],"class_list":["post-41758","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-for-beginners"],"_links":{"self":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/comments?post=41758"}],"version-history":[{"count":0,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41758\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media\/38126"}],"wp:attachment":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media?parent=41758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/categories?post=41758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/tags?post=41758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}