Thanks again to cybmeta for his comments in my earlier question.
Of course the solution is to use an archive template. The filename will be archive-foobar.php
. The target URL will indeed be mydomain.com/foobar
.
This works fine, even though for my purposes “archive” is a misnomer. The end user never sees the word “archive”.
Additionally, using the notes here, I needed to remember to:
1) If you want to use a custom archive page for your custom-post-type, add an additional argument to your
register_post_type() arguments: ‘has_archive’ => true…(This will tell WP to look for an archive template according to the
codex template hierarchy using the current slug setting of your custom
post type. If you want a custom slug for your archives, replace TRUE
with the slug name for example: ‘has_archive’ => ‘products’ might be
the slug you want to use with a ‘product’ post_type.)2) Visit the Settings -> Permalinks page to flush your current rewrite rules and rebuild with the new rules for your custom archive.