Container
Overview
A highly versatile content block for building everything from simple wrappers to complex callouts and link blocks, with extensive controls for styling, layout, and interactivity.
- Block name:
method/container - Category:
method-layout-blocks - Supports:
align(wide, full) - Render type: Dynamic (PHP
render_callback) - Inner blocks: Yes — accepts any blocks
Usage
The Container block is a general‑purpose wrapper that can function as a styled content card, a clickable link block, a hero unit with a background image/video, or a simple colored box. It shares much of the Section block’s background media system but adds optional link wrapping — when a link is set, the entire container renders as an <a> tag instead of a <div>.
Insert a Container, add inner content, and use the Inspector controls to configure background images, overlay shades, spacing, borders, shadows, colors, and responsive overrides. Use the block toolbar’s link control to make the entire container clickable.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
bgVideo | string | — | Video URL for Jarallax background video |
useParallax | boolean | false | Enables parallax scrolling on the background image |
textColor | string | — | Text color value |
linkColor | string | — | Link color value (hidden when container is itself a link) |
bgColor | string | — | Background color value |
bgGradient | string | — | Background gradient value |
bgShadeColor | string | — | Shade/overlay color |
bgShadeGradient | string | — | Shade/overlay gradient |
bgImg | object | { id: "" } | Background image object with size variants |
bgSize | string | — | Background image CSS size |
bgImgAlign | string | "center center" | Background image CSS position |
link | object | — | Link object with url, opensInNewTab properties |
responsiveSettings | object | (see below) | Per‑breakpoint settings |
responsiveSettings Structure
{
"base": { "enabled": true },
"mobile": { "enabled": false, "customBg": false },
"tablet": { "enabled": false, "customBg": false },
"wide": { "enabled": false, "customBg": false }
}
Beyond the keys every breakpoint-aware block shares (spacing, typography, dimensions, border, background image settings, alignItems), the Container reads overflow and zIndex (base, from Additional Options), mh (base, the MatchHeight group, printed as data-mh), aspectRatioX / aspectRatioY (emitted as aspect-ratio on the content element) and backdrop (a filter map emitted as backdrop-filter; see MethodBackdropControls).
Control Sets
| Component | Panel | Breakpoints | Notes |
|---|---|---|---|
MethodAlignmentControls | Alignment | base, mobile, tablet, wide | alignItems only; labeled “Content Vertical Alignment” |
MethodSpacingControls | Spacing | base, mobile, tablet, wide | Padding (all 4 sides) + Margin (all 4 sides) |
MethodDimensionControls | Dimensions | base, mobile, tablet, wide | height, minHeight, width, minWidth, mhGroup (base), aspectRatio |
MethodTypographyControls | Typography | base, mobile, tablet, wide | — |
MethodBorderControls | Border | base, mobile, tablet, wide | — |
MethodShadowControl | Shadow | base only | — |
MethodBackgroundControls | Background Media | base, mobile, tablet, wide | includeVideo enabled on base |
MethodColorControls | Colors | global | When linked: textColor, bgColor, bgShadeColor. When unlinked: adds linkColor |
MethodLinkToolbar | Toolbar | — | Block toolbar link popover |
MethodResponsiveTabs | Responsive | mobile, tablet, wide | Wraps per‑breakpoint controls |
MethodAddtControls | Additional Options | base | overflow, zIndex |
MethodBackdropControls | Background Filters | base, mobile, tablet, wide | backdrop filters on .method-container-content |
MethodStyleTag | — | — | Scoped editor <style> |
Data & Dependencies
- Jarallax: Both
jarallax.min.jsandjarallax-video.min.jsare enqueued viamethod_container_enqueue_assets. Editor initialization uses the same retry‑baseduseEffectpattern as the Section block. - Link behavior: When
link.urlis set, both editor and frontend render the block root as an<a>tag. The Color Controls panel adapts to hide thelinkColoroption (since the entire block becomes the link). The link color is applied witha:not(.method-theme-button), so Theme Buttons inside the container keep their own colors. - MatchHeight: a base
mhgroup name is printed asdata-mhon.method-container-content, which the theme’s matchHeight script reads to equalise containers that share a group.
Frontend Rendering
<!-- Without link -->
<div class="method-container" id="method-{id}">
<div class="method-container-content {jarallax?}">
{jarallax-img?}
<div class="method-container-bgimg"> </div>
<div class="method-container-shade"> </div>
{inner block content}
</div>
</div>
<!-- With link -->
<a target="_self|_blank" href="{url}" class="method-container" id="method-{id}">
<!-- same inner structure -->
</a>
Filters
This block does not currently expose dedicated PHP filters. Customization is handled through CSS targeting the generated #method-{id} selectors.
Changelog
| Version | Description |
|---|---|
| 2.0.0-alpha4 | Introduced (e9bc082). |
| 2.0.0-beta5 | Additional Options (MethodAddtControls): overflow and zIndex at the base breakpoint, zIndex emitted on the wrapper (1a17d90). |
| 2.0.0-beta8 | Aspect Ratio in the Dimension panel (aspectRatioX / aspectRatioY), so a container can be sized by ratio instead of, or as well as, a fixed height (bd7d2f4). |
| 2.0.0-beta10 | The MatchHeight group is printed on the frontend as data-mh on the content element (9771ac7). |
| 2.0.0-beta17 | Link color selector narrowed to a:not(.method-theme-button) so Theme Buttons inside a container keep their colors (60b9b07); the tablet and wide Align Items tabs now write to their own breakpoint instead of the mobile one (e0c49e6); useParallax corrected from the invalid type bool to boolean (b4c7dcb); Inserter title prefixed, “Method Container” (c34e9bb). |
| 2.0.0-beta20 | Background Filters panel (MethodBackdropControls) at the base breakpoint; backdrop emitted as backdrop-filter on .method-container-content (ae61c10). |
| 2.0.0-beta21 | Background Filters offered in the mobile, tablet and wide tabs as well (00817a3); .method-container-bgimg defaults to background-size: cover and the Background Size options were reworked (75910d2). |
| 2.0.0-beta22 | A new Container starts with a placeholder paragraph (“Container content goes here…”) (4f34c8b); Retitled “Container (Method)” and given the method keyword (93e1fcf). |