Can I define page types in my theme (instead of building them out in the backend)?
immersiontravis - 3 weeks ago
The "Creating Your First Page" video explains how backend users can create custom page types.
However, I'd prefer to define page types and templates in my theme, for three reasons:
- I want to source-control my page types.
- It fits more naturally with my development workflow. When building a theme, I typically edit CSS, layout-level HTML, and page-level HTML all at the same time. I'd rather stay in my IDE for this, instead of jumping over to the backend to edit page-level HTML.
- I don't want backend users to be able to edit page types. In other words, I want page types and templates to be defined by the developer at development time, not by the backend user after launch. (I'm sure that I could prevent this via user permissions – so consider this a bonus reason, I guess.)
So: is it possible to do this? There seems to be a CMS trend toward giving backend users the ability to create arbitrary layouts – but in my experience, giving clients that freedom is a great way to end up with a trashy site.