I have the following structure:
/projects
(archive of cptprojects
with templatearchive-projects.php
)/projects/project-1
(single view of cpt with templatesingle-projects.php
)/projects/downloads
(this is a page)
When I try to open /projects/downloads
I get an 404 error.
Is there a way to set a page in the custom post type hierarchy?
This is possible, but it will require playing with the rewrite rules. Install my Rewrite analyzer, you will need it.
I answered a very similar question, but the main difference was that where you have
/projects/
as a “clean” custom post type archive, the other user had it as a page, which is much easier.If you want to create subpages of
/projects/
you will have to create a page with the slugprojects
. Then you have two options: the easy one is to use a page template for this/projects/
page that just queries for your custom post type, like we used to do before WP 3.1 arrived with native support for custom post type archives. The other option is to filter the verbose page rules and throw out everything related to the/projects/
page, so that only the/projects/
rules for the custom post type archive remain.here is an idea,
create a custom post type say
downloads
with rewrite slugprojects/downloads
and then each download as a new post of downloads custom post type.