Skip to content
Docs
Get RestroPress

Filter

rpress_pack_components

Updated
On this page

Filters a template pack's merged component settings.

Applied by rpress_get_pack_components() after the settings of the pack's parents and the pack itself are merged. The result is validated against the component schema again, so unknown or invalid values are removed. Core turns the settings into inline CSS on menu pages. A pack with any component settings also makes the storefront use the list menu templates instead of grid.

Available since RestroPress 3.5.1.

Parameters#

ParameterTypeDescription
$mergedarrayComponent => settings.
$packarrayPack being resolved, normally the active one.

Return value#

array. Component => settings.

Example#

add_filter( 'rpress_pack_components', 'my_pack_components', 10, 2 );
function my_pack_components( $merged, $pack ) {
	if ( isset( $merged['card'] ) ) {
		$merged['card']['radius']     = '16px';
		$merged['card']['desc_lines'] = 3;
	}
	return $merged;
}

Notes#

Adding settings to a pack that has none, such as Classic, also switches its storefront from grid to list templates.

Source#

Applied in:

  • includes/features/storefront-layout/components.php (line 182), in rpress_get_pack_components()

See also#

Was this page helpful?