Where to put archive-{post-type}.php

I have a plugin that adds a custom post type for a website I’m building. I am using the_content filters to change how a singular page looks, and it works great, allowing me to keep everything contained in the plugin.

However, I want to render a custom archive page using dls and what not, but I have no idea how to do this. This website will probably always use the same theme, but I still want to keep my plugin as separated from the theme as possible.

1 Answer
1

The archive-{post-type}.php files goes directly in your theme directory. Notice that you will also need to make sure has_archive is set to true for any post types you wish to display as archives. Depending on how you registered you post type the method used to change this might differ. I’m really just familiar with registering manually using register_post_type, in which case you simply need to include 'has_archive' => true in your arguments array, but I would suspect the corresponding functionality to be available in most post type related plugins.

Leave a Comment