Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress Display All Posts

THis may be really easy but i have searched and search and cant find anything. What is the default blog page?

I am trying to find the page that will display excerpts of all my blog posts regardless of category or tags. I know that I can do www.xyz.com/category/widgets to get a list of all the posts in that category. What I am trying to do is just list all my blog posts without any filter.

Is there a default page in wordpress to achieve this? Thank you.

like image 589
user982853 Avatar asked Oct 11 '12 16:10

user982853


2 Answers

If you want it for all categories/tags/fron_page, there is very quick sollution - go to /wp-admin/options-reading.php and set the number of posts to -1 - it is not normally possible as the input got min=1, but you can change it easily with e.g. browser developer console.

If you want just one page with all posts, you can simply create template or shortcode, with http://codex.wordpress.org/Template_Tags/get_posts and numberposts set to -1 and show what you need, e.g.

<?php
$args = array( 'numberposts' => -1); 
$posts= get_posts( $args );
if ($posts) {
    foreach ( $posts as $post ) {
        setup_postdata($post);
        the_title();
        the_excerpt();
    }
}
?>
like image 176
Tomáš Kapler Avatar answered Sep 24 '22 06:09

Tomáš Kapler


For others who might be Googling this... If you have replaced the front page of your site with a static page, but still want your list of posts to appear under a separate link, you need to:

  1. Create an empty page (and specify any URL/slug you like)
  2. Under Settings > Reading, choose this new page as your "Posts page"

Now when you click the link to this page in your menu, it should list all your recent posts (no messing with code required).

(Disclaimer: I posted this same answer to a similar question here.)

like image 33
Simon East Avatar answered Sep 23 '22 06:09

Simon East