I find myself creating pages just as a “placeholder” to a listing page.
eg. I create a page “Blog” and “Portfolio”. Both has the editor emtpy. And I just use it so that I can use page-blog.php
and page-portfolio.php
for the respective listing pages. It doesnt seem proper? Is there a better way?
I guess another way would be including
'has_archive' => true,
into your register_post_type array and using archive-{posttype}.php to style your custom post type listingsI only use ‘placeholder’ pages if I’m listing just a few custom post types with no pagination (or any other miscellaneous data for that fact), so that the end user still has control over the things like the title & content (which you can use for introductory text and so forth).
It also has the advantage of getting listed in
wp_list_pages()
, which is handy if you’re using it for navigation elsewhere in your theme.However, as @Daniel said, if you want to make benefit of a full-blown archive with pagination & feeds, opt for the
has_archive
arg.I tend to use a different slug for the archive as opposed to the single post, just for clarity.
So for example;
And for archives;
The code for it?