PostTypes icon indicating copy to clipboard operation
PostTypes copied to clipboard

v3.0

Open jjgrainger opened this issue 1 year ago • 0 comments

v3.0

PostTypes v3 moves away from the old approach of building post types step-by-step using method calls, and instead adopts a class-based, declarative design. Rather than constructing post types imperatively—by calling methods line by line at runtime—developers now define them declaratively by extending an abstract PostType class and implementing specific configuration methods.

This change reflects a simpler and more maintainable philosophy: instead of building a post type procedurally, you now describe what a post type is. This aligns better with how post types are typically used—defined once and remaining consistent throughout an application.

Key changes

  • PostType is now an abstract class; post types are defined by subclassing and implementing methods like name(), options(), labels(), and columns(). The same is true for the Taxonomy class.
  • Configuration is declarative—developers describe the post type’s structure instead of composing it step-by-step through method calls.
  • Improves readability, testability, and removes the need to pass post type objects around the codebase.
  • Designed for consistency, clearer tooling support, and easier static analysis.

jjgrainger avatar Dec 04 '24 21:12 jjgrainger