I'm building a theme and I've found it all pretty simple and straightforward.

However, I can't figure out why I have a totally blank page for my archive WordPress blog posts?

I understand the WordPress Hierarchy and I have a page called:


This is my code on that page:

    <?php get_header();?>

    <div class="container">

      <h1><?php echo single_cat_title();?></h1>

      <?php if( have_posts() ): while ( have_posts() ): the_post();?>

<div class="card">
  <div class="card-body">
    <h3><?php the_title();?></h3>

    <?php the_excerpt();?>

    <a href="<?php the_permalink();?>" class="btn btn-success"> read more</a>

<?php endwhile; else: endif;?>

      <?php previous_posts_link();?>
      <?php next_posts_link();?>


    <?php get_footer();?>

And when I view that page view a browser, i.e. my designated "blog page" in WordPress (selected in "Reading") I see nothing, totally blank, there is even no source to view.

Any idea on what (basic) error I am making here....


  • 1
    archive.php is not used for Pages, even if you have set one as the "blog page." Try renaming your file page-slug.php - i.e. if the Page is at example.com/my-page, the slug is "my-page", so name the file page-my-page.php - that way your template will apply to the Page you've created. – WebElaine Dec 16 '19 at 22:09
  • Hmm, I'm a bit confused though because what I am trying to do is just loop the blog posts - that's it. What am I missing? What is the "generic" WP hierarchical page that will list blog posts then? – henry Dec 16 '19 at 22:29

Your designated 'blog page' (selected in 'Reading') will use the index.php file (or home.php) rather than archive.php file.

WP hierarchy

  • Ah I see - so index.php is the "blog page" page? Seems to work for me – henry Dec 17 '19 at 0:03
  • Yep, generally. Unless you have a home.php. Normally it falls back to index.php, but you can create your own home.php if you want to target it specifically. – Monkey Puzzle Dec 17 '19 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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