Closed darylldoyle closed 7 months ago
From my perspective something like this would be very useful because pretty much every single project I've worked on needed multiple CPT's and every project does them slightly differently.
I am in favor of having the CPT's and anything that dictates the information architecture inside a plugin / plugins.
Is your enhancement related to a problem? Please describe.
All new 10up projects are based on this repo, but there is very little PHP scaffolding in place. This means that each different project ends up with a slightly different implementation for post types, taxonomies, REST endpoints etc.
This has two effects:
Designs
Since the auto-initialisation of modules was merged in #158, it's allowed us to create much more modular scaffolds, with no requirement for factory classes etc.
I propose introducing abstract classes that contain all the base information needed to register a CPT/Taxonomy, which can then be extended to implement project-specific ones.
For example, the following abstract post type would then allow us to easily implement further ones:
To implement a project-specific CPT, we'd then do something like:
Due to the fact that we have auto-initializing modules, the engineer would only need to create the sub-class and fill it out. There's no need to add anything to a factory, meaning less merge conflicts.
We can also do something very similar for taxonomies.
This solution would provide engineers with:
It also gives us a nice lead-in to creating a tool to help scaffold these items quickly, much like has been proposed in #89
Describe alternatives you've considered
Darshan has also submitted https://github.com/10up/wp-scaffold/issues/104. I don't feel like this is an alternative to that approach, but it could be complimentary to it by proving a start for that modular scaffold.
Code of Conduct