WP Framework is a lightweight set of building blocks for structuring WordPress plugins and themes around small, composable Modules. It provides:
- Module discovery and initialization (with a predictable lifecycle)
- Base classes for custom and core post types
- Base class for taxonomies
- Asset helpers that read modern build sidecars (
.asset.php)
- External engineers — Start here: follow the Quick Start and then read Autoloading and Modules → Modules and Initialization → Post Types/Taxonomies → Asset Loading.
- Internal engineers — Concepts: jump straight to Modules and Initialization and the specific Post Types/Taxonomies APIs. Skim the Quick Start for constants and bootstrap.
- Non‑technical stakeholders — Overview: This framework standardizes how we register types, taxonomies, and assets so teams ship features faster with less boilerplate and more consistency.
- Add PSR-4 autoloading in composer.json for your project namespace (inc/ or src/).
- Define constants (
YOUR_PLUGIN_PATH,YOUR_PLUGIN_URL,YOUR_PLUGIN_INC,YOUR_PLUGIN_VERSION) in your plugin/theme bootstrap. - Initialize modules:
TenupFramework\ModuleInitialization::instance()->init_classes( YOUR_PLUGIN_INC ). - Implement small classes that implement
ModuleInterface(use theModuletrait) and optionally extendAbstractPostType/AbstractTaxonomy. - Load assets via the
GetAssetInfotrait using dist/.asset.php sidecars.
- Autoloading and Modules — how classes are discovered and initialized
- Modules and Initialization
- Post Types — building custom and core post type integrations
- Taxonomies — registering and configuring taxonomies
- Asset Loading — working with dist/.asset.php for dependencies and versioning
- Namespaces: use your project namespace (e.g.,
YourVendor\\YourPlugin) for app code; reference framework classes via the TenupFramework namespace. - Translation: return translated strings from label methods using the correct text domain.
- Keep Modules small and focused; guard execution in
can_register()to keep admin/frontend/REST behaviors tidy.