Custom Post Type Archives - Crazy Loop

I assume, moving from Roots to Sage, archive.php has been ditched to make more it more KISSable. So, now there’s just the index.php for Archives. That’s fantastic. However, when creating a custom post type, and specifying has archives to the CPT, a somewhat endless loop occurs. It repeats a single post over and over again.

Changing this line…

<?php get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>

…to this…

<?php get_template_part('templates/content', get_post_format()); ?>

…makes it all better.

I’m guessing the intended function checks for custom posts as well and includes them with the category posts?

Otherwise, the reason why it’s not looping correctly is due to a user error—me.

Actually it is checking for the slug of the CPT. So if you have staff, it checks for templates/content-staff.php, and if it’s not found, defaults to content.php.

And no, there should not be a strange loop by default :slight_smile:

Thanks a bunch @kalenjohnson. That was exactly the problem, me, misusing a template part because I misinterpreted that function.