Skip to content
Docs
Get RestroPress

Filter

rpress_storefront_layout

Updated
On this page

Filters the storefront layout in effect.

Runs at the end of rpress_get_storefront_layout(), after core defaults, each parent pack's layout, the active pack's layout and the saved storefront_layout option have been merged. The storefront layout features use the result on menu pages for body classes, the masthead, category navigation, rails and section order. The returned array is not cleaned again, so use only keys and values the layout schema allows.

Available since RestroPress 3.5.1.

Parameters#

ParameterTypeDescription
$layoutarrayMerged layout with keys such as masthead, nav_style, nav_media, columns, card_style, show_image, cart_style, item_style, rails and sections.
$packarrayThe active template pack.

Return value#

array. The layout to use.

Example#

add_filter( 'rpress_storefront_layout', 'my_storefront_layout', 10, 2 );
function my_storefront_layout( $layout, $pack ) {
	if ( isset( $pack['id'] ) && 'modern' === $pack['id'] ) {
		$layout['rails']   = array( 'popular', 'deals' );
		$layout['columns'] = 2;
	}
	return $layout;
}

Notes#

The storefront components ignore the layout when the old menu interface option is enabled.

Source#

Applied in:

  • includes/class-rpress-template-packs.php (line 436), in RPRESS_Template_Packs::get_storefront_layout()

See also#

Was this page helpful?