Showing a list of posts when homepage is custom

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.

Read More

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?

Related posts

Leave a Reply

2 comments

  1. 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
  2. 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>';
    endwhile;
    
    // Reset Query 
    wp_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 😉
    Sagive.

    .

    (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)