I am developing a custom theme.

I edited my home.php to show something custom. I also edited index.php to display a list of posts or other things.

After this I can't get a list of all posts which was by default displayed at the home page.

Which URL can I use to access the list of posts?


2 Answers 2


First, you need to familiarize yourself with the WordPress Template Hierarchy, so that you ensure that you are modifying the appropriate template file:

  • Home: Blog Posts Index page; template file: home.php
  • Front Page: Site Front Page; template file: front-page.php

I am assuming that you want to display a static front page, and to display your blog posts index on a separate page? If so:

  1. Use the front-page.php template file to define the custom front-page markup
  2. Use the home.php template file to define the markup for your blog posts index (or, omit entirely, and let the blog posts index simply fall back to index.php)
  3. Create two static pages: one as the site front page placeholder, and one as the blog posts index placeholder
  4. Set Dashboard -> Settings -> Reading appropriately
  • 1. I do not use static pages. 2. I renamed home.php into front-page.php as you suggested. (I now have no home.php as it uses index.php). But my issue is not solved, I don't know how to display (what URL should I type in a browser) the list of all posts. Please help.
    – porton
    Apr 2, 2012 at 16:10
  • 1
    Did you follow steps 3 and 4 above? You need to be using static pages, if you are outputting anything other than your Blog Posts Index on your site front page. Apr 2, 2012 at 16:12

If you want a global recent posts list you need to create a loop
that would show them if you want to show them in your home.php you can use this code where you want.. (no inside the loop)

// The Query
$args = array(
    'posts_per_page' => 10,
    'orderby' => 'date',
    'order' => 'ASC'
query_posts( $args );

// The Loop
while ( have_posts() ) : the_post();
    echo '<li>';
    the_title().'<br />';
    the_excerpt().'<br />';
    echo '</li>';

// Reset Query 

i have left the amount of posts shown there so you can control it...
Additional arguments you can use to refine the loop can be found at WP Query in the wordpress codex...

Hope this Helps ;)


(p.s: 0% accept rate which is what you have is not ok.. you should go back to the question you asked and either answer them yourself or pick the correct answer if exist and approve it... It best for the community)

  • 2
    The home.php template file is intended for output of the Blog Posts Index, and should not be used to define custom front-page markup. Use front-page.php for this purpose. Apr 2, 2012 at 15:25
  • The way i see it is that you can define a query wherever you want.. no such thing "Meant to" - thats the great thing about wordpress
    – Sagive
    Apr 2, 2012 at 15:26
  • Uh, yes, there is such a thing as meant to. In fact, meant to is the entire purpose of the Template Hierarchy. If you conflate home.php and front-page.php, and use home.php to output custom static front page content when home.php is meant to output the blog posts index, things WILL break. Apr 2, 2012 at 15:28
  • i have built many homepages where is have static content and a mini loop showing whats new somewhere on page... i considre it to be much more dynamic from an seo point of view. lets agree to dissagree ;)
    – Sagive
    Apr 2, 2012 at 15:31
  • No, sorry; can't "agree to disagree" on this one. Your scenario only works if/when the Blog Posts Index is not output on a separate page when using a static front page. This scenario is an edge case for any site that actually uses blog posts. Apr 2, 2012 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.