WPDev.one
Core Function
View Source on Trac ↗

wp_get_layout_style()

wp_get_layout_style( mixed $selector, mixed $layout, mixed $has_block_gap_support = false, mixed $gap_value = null, mixed $should_skip_gap_serialization = false, mixed $fallback_gap_value = '0.5em', mixed $block_spacing = null )

Generates the CSS corresponding to the provided layout.

Parameters 4 required

Name / Type Description
$selector
string

CSS selector.

Required
array

$layout Layout object. The one that is passed has already checked the existence of default block layout.

Required
$has_block_gap_support
bool

Optional. Whether the theme has support for the block gap. Default false.

(string

| string[] | null) $gap_value Optional. The block gap value to apply. Default null.

Required
$should_skip_gap_serialization
bool

Optional. Whether to skip applying the user-defined value set in the editor. Default false.

$fallback_gap_value
string

Optional. The block gap value to apply. Default '0.5em'.

(array

| null) $block_spacing Optional. Custom spacing set on the block. Default null.

Required

Return Value

(string)
CSS styles on success. Else, empty string.

Function Information

Since Version
5.9.0
Source File
wp-includes/block-supports/layout.php
Advertisement