Why won't my posts appear on the Static Page I select for my Blog?

I have been creating Wordpress themes for a couple of years and could never figure this one out.

In Settings-->Reading-->I select "Static Page" for Front Page...

My Front Page is set to "Home"
My Blog Page is set to "Blog", a page I created and it uses a template I created called "Blog". The template has the loop on it, but it doesn't seem to pick it up. I know it defaults to index.php or home.php in the Template Hierarchy...but why is there an option to set the template to on the edit page for the blog page if it doesn't pick it up? In other words, the code from my page-blog.php is ignored while it uses index.php or home.php's code instead. Thoughts? Or perhaps, I am missing something?

  • Ash
    • WordPress Hacker

    Hello @TimMorris-Design

    I hope you are well today and thanks for asking the question.

    Would you please select "---- Select ----" for Post page from Settings > Reading? That means don't select any page for posts page. But keep selected page for home page. Let me know if that trick works for you.


  • TimMorris-Design
    • The Incredible Code Injector

    Hey Ash,
    With "Select" chosen on the drop down I still can't get the posts to appear on my page-blog.php template for my blog page. Do I need to do a wp_query like this below?

    // the query
    $the_query = new WP_Query( 'posts_per_page=5' ); ?>

    <?php if ( $the_query->have_posts() ) : ?>

    <!-- pagination here -->

    <!-- the loop -->
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <p><?php the_content(); ?></p>
    <?php endwhile; ?>
    <!-- end of the loop -->

    <!-- pagination here -->

    <?php wp_reset_postdata(); ?>

    <?php else: ?>
    <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
    <?php endif; ?>`

    I just thought I could do it without having to use a wp_query and with just a basic loop. I guess not?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.