Archive page showing nothing – issue with WordPress Hierarchy?

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:

archive.php

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="https://wordpress.stackexchange.com/questions/354730/<?php the_permalink();?>" class="btn btn-success"> read more</a>
  </div>
</div>

<?php endwhile; else: endif;?>

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

    </div>

    <?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….

Thanks

1 Answer
1

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

WP hierarchy

Leave a Comment