WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a hierarchical custom post type (missions) setup. I want to create a few child pages for it (discuss, petition, educate), but I want each of those child pages to display a different template.

There does not appear to be a way to use a selected template, like on a normal page, so I thought maybe I could just have the child custom post type pages display content based on their slug.

So the permalinks would appear as:

 - /mission/mission-01/discuss/
 - /mission/mission-01/petition/
 - /mission/mission-01/educate/

 - /mission/mission-02/discuss/
 - /mission/mission-02/petition/
 - /mission/mission-02/educate/

Since they are children, and the Discuss pages could all use the same slug, maybe a function that gives all pages with slug /discuss/ the page-discuss-template.php from my theme directory.

Thanks for any help!

share|improve this question
With Custom Post Types you indeed cannot choose a template like you can for "normal" pages, but you can make a template called missions.php which will be called before page.php if it exists. I don't know however how this will work with children of the custom post type, but you could try it out to see what happens? – Piet Apr 15 '11 at 2:21
the only problem i see is that you can't have two pages with the same slug, but there is a solution take a look at wordpress.stackexchange.com/questions/8608/… and to that you just need to add a rewrite rule to make the links nice. – Bainternet Apr 15 '11 at 2:38
Also, check @Mike Schinkel's answer to this question - wordpress.stackexchange.com/questions/858/… - which seems to be after a similar solution as you're looking for. – goldenapples Apr 15 '11 at 2:45
Thanks goldenapples. I believe Mike Schinkel's solution just might do the trick! – Chad Von Lind Apr 15 '11 at 18:08
I actually ended up going with what you provided, Bainternet. Thanks to both of you guys. – Chad Von Lind Apr 15 '11 at 20:41
up vote 0 down vote accepted

There are two approaches to my question, that are both useful. They were provided by @goldenapples and @Bainternet.

Custom Post Type Data in Sidebar widgets?

How to quickly switch custom post type singular template?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.