Exclude child/nested posts from showing on the automatic archive page
-
Hello! I’ve created a custom post type called “themes”. I’ve set the Archive and the Hierarchy options to true. I didn’t create any taxonomies. I’m just nesting the same custom post type as a child and it seems to work.
The structure is set-up like this at the moment:
- Themes (archive page) - Theme 1 (CPT "themes") -- Sub theme 1 (CPT "themes") -- Sub theme 2 (CPT "themes") -- Sub theme 3 (CPT "themes") - Theme 2 (CPT "themes") -- Sub theme 1 (CPT "themes") -- Sub theme 2 (CPT "themes") -- Sub theme 3 (CPT "themes")
The issue that I’m having is that the archive page shows all the theme’s and subtheme’s. I would like it to only display the first level of theme’s. So it would be nice if the archive page should just list:
Themes (archive page) - Theme 1 (CPT "themes") - Theme 2 (CPT "themes")
And then when you open Theme 1 it should display the content of the custom post type which could be text and some images. Below it is should list:
-- Sub theme 1 (CPT "themes") -- Sub theme 2 (CPT "themes") -- Sub theme 3 (CPT "themes") -- etc.
Am I forgetting some kind of setting that I could activate to exclude all of the sub theme’s/posts from the automatic archive page? Or do I need to add some updates to a query somewhere? I’ve seen some examples where they add some specific override in the functions.php to adjust things. I just couldn’t get it to work in my situation.
Every help would be appreciated. Thanks a lot!
- The topic ‘Exclude child/nested posts from showing on the automatic archive page’ is closed to new replies.