Filter
rpress_storefront_layout_schema
On this page
Filters the storefront layout keys and the values allowed for each.
The schema is used to clean a template pack's recommended layout and the saved storefront_layout option: unknown keys and values are dropped. Each entry is a list of allowed values, or the string 'bool'. Adding a value here only lets it pass validation; you also need your own styles or markup to render it. For rails and sections, the given order is kept and duplicates are removed.
Available since RestroPress 3.5.1.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$schema | array | Layout key => list of allowed values, or a type string. Core keys: masthead, nav_style, nav_media, columns, card_style, show_image, cart_style, item_style, rails, sections. |
Return value#
array. The schema in the same shape.
Example#
add_filter( 'rpress_storefront_layout_schema', 'my_layout_schema', 10, 1 );
function my_layout_schema( $schema ) {
$schema['card_style'][] = 'my_polaroid';
return $schema;
}
Notes#
Template packs are registered on init priority 5 and cleaned against this schema then, so add the filter before that (for example when your plugin file loads).
Source#
Applied in:
includes/class-rpress-template-packs.php(line 343), inRPRESS_Template_Packs::layout_schema()
See also#
Was this page helpful?
