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

AttributeTypeDefaultDescription
bgVideostring—Video URL for Jarallax background video
useParallaxbooleanfalseEnables parallax scrolling on the background image
textColorstring—Text color value
linkColorstring—Link color value (hidden when container is itself a link)
bgColorstring—Background color value
bgGradientstring—Background gradient value
bgShadeColorstring—Shade/overlay color
bgShadeGradientstring—Shade/overlay gradient
bgImgobject{ id: "" }Background image object with size variants
bgSizestring—Background image CSS size
bgImgAlignstring"center center"Background image CSS position
linkobject—Link object with url, opensInNewTab properties
responsiveSettingsobject(see below)Per‑breakpoint settings

responsiveSettings Structure

JSON
{
  "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

ComponentPanelBreakpointsNotes
MethodAlignmentControlsAlignmentbase, mobile, tablet, widealignItems only; labeled “Content Vertical Alignment”
MethodSpacingControlsSpacingbase, mobile, tablet, widePadding (all 4 sides) + Margin (all 4 sides)
MethodDimensionControlsDimensionsbase, mobile, tablet, wideheight, minHeight, width, minWidth, mhGroup (base), aspectRatio
MethodTypographyControlsTypographybase, mobile, tablet, wide—
MethodBorderControlsBorderbase, mobile, tablet, wide—
MethodShadowControlShadowbase only—
MethodBackgroundControlsBackground Mediabase, mobile, tablet, wideincludeVideo enabled on base
MethodColorControlsColorsglobalWhen linked: textColor, bgColor, bgShadeColor. When unlinked: adds linkColor
MethodLinkToolbarToolbar—Block toolbar link popover
MethodResponsiveTabsResponsivemobile, tablet, wideWraps per‑breakpoint controls
MethodAddtControlsAdditional Optionsbaseoverflow, zIndex
MethodBackdropControlsBackground Filtersbase, mobile, tablet, widebackdrop filters on .method-container-content
MethodStyleTag——Scoped editor <style>

Data & Dependencies

  • Jarallax: Both jarallax.min.js and jarallax-video.min.js are enqueued via method_container_enqueue_assets. Editor initialization uses the same retry‑based useEffect pattern as the Section block.
  • Link behavior: When link.url is set, both editor and frontend render the block root as an <a> tag. The Color Controls panel adapts to hide the linkColor option (since the entire block becomes the link). The link color is applied with a:not(.method-theme-button), so Theme Buttons inside the container keep their own colors.
  • MatchHeight: a base mh group name is printed as data-mh on .method-container-content, which the theme’s matchHeight script reads to equalise containers that share a group.

Frontend Rendering

HTML
<!-- 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

VersionDescription
2.0.0-alpha4Introduced (e9bc082).
2.0.0-beta5Additional Options (MethodAddtControls): overflow and zIndex at the base breakpoint, zIndex emitted on the wrapper (1a17d90).
2.0.0-beta8Aspect 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-beta10The MatchHeight group is printed on the frontend as data-mh on the content element (9771ac7).
2.0.0-beta17Link 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-beta20Background Filters panel (MethodBackdropControls) at the base breakpoint; backdrop emitted as backdrop-filter on .method-container-content (ae61c10).
2.0.0-beta21Background 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-beta22A new Container starts with a placeholder paragraph (“Container content goes here…”) (4f34c8b); Retitled “Container (Method)” and given the method keyword (93e1fcf).