Custom use cases (developers)
Site owners use built-in use cases from the template editor. Developers can add new output types by registering a PHP class and hooking it into CoverKit’s registry.
This page is a checklist; architecture and APIs are documented in Use cases and output profiles. Built-in variants are summarized in the Use cases overview.
Checklist
Section titled “Checklist”-
Subclass
CoverKit\Use_Case(or an existing built-in if you are extending behavior safely). -
Register on
coverkit_init(priority before 10 if you need to load before built-ins):add_action( 'coverkit_init', function () {coverkit_register_use_case('my_output',array('class' => My_Output_Use_Case::class,'label' => __( 'My output', 'my-plugin' ),));} ); -
Implement
protected function init(): void— register only hooks/filters; keep it cheap. -
Define optional settings schema, recommended dimensions/formats, and mapping sources on the class.
-
Document required mappings for editors (labels, required vs. recommended).
-
Test enablement on a template, save assignments, and confirm render + cache behavior.
Mandatory registration data: slug, label, class.
Variants vs. filters
Section titled “Variants vs. filters”| Approach | When |
|---|---|
| Filter on mapping sources or labels | Small tweak to an existing use case |
| New slug + subclass | A distinct option in the UI (for example sidebar_image_product extending sidebar behavior) |
New class extending Use_Case directly | Substantially different behavior |
Do not mutate a built-in registration globally to fork behavior—register a new slug instead.
What editors will see
Section titled “What editors will see”After registration, your use case appears in the template editor Use cases sidebar like built-ins: enable, settings (if any), and field-to-layer mapping.
Cardinality (one assignment per template vs. multiple instances) is defined on the use case class—editors cannot override that in the UI.
Built-in reference
Section titled “Built-in reference”Study these implementations in the plugin:
CoverKit\Use_Cases\Sidebar_Image_Use_CaseCoverKit\Use_Cases\Open_Graph_Image_Use_CaseCoverKit\Use_Cases\Minimal_Use_Case
Registration: includes/use-cases/bootstrap.php.