How to apply template to single page and all of it's subpages

So looking to create templates, that would apply to a single page, but also all of its subpages automatically.

Is this possible with some snippet or code?

Right now I believe you need to select pages individually but it would be nice to have the option to select a page parent that would then apply the template to all child pages.

1 Like

Hi @jdang !

Welcome to the forum and happy new year!

For Pages it’s not possible to set template condition like “parent and all childs”. But if you can do it without Pages and use Posts instead, you could set individual Templates for certain categories or tags.
Or as @zestjosh said, pick each page individually.
Another option is to use Custom Post Types if you are going to use a lot affected pages.

The way its set up, yeah posts doesn’t really work, I mean it can. And I thought about the CPT but it might be 40-80 different CPTs and only be about 10 pages each, so the CPT sounds a little cumbersome. But I’ll try and figure this out. Thanks!