I'm working on a plugin which registers a new post type, and I want to be able to define a default loop for the archive page. I've been trying to brainstorm the best way to do this, and I keep coming up short.
Basically, what I need to do is this:
My post type should display in archive pages as title, excerpt, and custom field only. I also need to run certain filters on the archive page.
I've been asking users to create their own archive-{myposttype}.php file, but that is a little over the heads of casual site owners.
So, thoughts I have had include:
- Creating my own template file that I load on the template_redirect hook... probably out, as there's really no way to generate the correct markup for a given theme.
- Trying to save a new file on plugin activation by some crazy regex processing of existing template files... I think that it might be possible, but I feel like I must be doing something wrong.
- Asking users to choose an existing page to hold the archive for my custom post type, then using the_content filter to output my archive... which is very doable, but then I have to hack the query a good deal, and I end up breaking the is_query conditionals and so on...
This question may be too subjective to provide a good answer to, but I'd like to hear any thoughts on it.