Why is my site using index.php instead of archive?

Developing my first custom theme and I started out using an individual page-$slug.php to display a list of each custom post. Have since learned that archive.php is better for this purpose (but I just want to use one if possible).

So in admin I’ve changed the links to the ‘post type archive’ instead of the page I’d created, and set has_archive to true for each cpt.

But the link now takes me to index.php

My archive.php so far is just this:

<?php
get_header();

if (have_posts()):
while (have_posts()): the_post();
the_title();
the_content();
endwhile;
endif;

get_footer();
?>

How do I get it do use the archive.php template and output just the posts of the requested type?

Thanks in advance!

Read more here:: Why is my site using index.php instead of archive?

Leave a Reply

Your email address will not be published. Required fields are marked *