Overview

A full‑width content wrapper with robust styling and layout controls, designed to define major sections of a page.

  • Block name: method/section
  • Category: method-layout-blocks
  • Supports: align (wide, full)
  • Render type: Dynamic (PHP render_callback)
  • Inner blocks: Yes — accepts any blocks
  • Uses context: postId, postType (for the featured-image background)

Usage

The Section block is the primary structural building block for full‑width page layouts. It outputs a <div> wrapper with layered background support (color, image, shade overlay), optional parallax and video backgrounds via Jarallax, and inner content that can optionally be constrained to the theme’s content width.

Insert a Section block, set it to Full Width alignment, and begin adding content inside it. Use the Inspector panel to configure spacing, background media, colors, dimensions, and responsive overrides.

When a Section is set to Full Width alignment, an Unconstrain Content toggle becomes available. When disabled (default), inner content respects WordPress’s constrained layout (is-layout-constrained with has-global-padding). When enabled, inner content stretches edge‑to‑edge.


Attributes

AttributeTypeDefaultDescription
unconstrainedbooleanfalseWhen true, disables constrained layout on full‑width sections
bgVideostring—Video URL for Jarallax background video (YouTube, Vimeo, or direct)
useParallaxbooleanfalseEnables Jarallax parallax scrolling on the background image
textColorstring—Text color value
linkColorstring—Link color value
bgColorstring—Background color or gradient value
bgGradientstring—Background gradient value
bgShadeColorstring—Shade/overlay color value
bgShadeGradientstring—Shade/overlay gradient value
bgImgobject{ id: "" }Background image object containing size variants with URLs
bgMediastring""Background Media mode: empty for image / video, slideshow for a Vegas image slideshow
imagesarray[]The slideshow images ({ id, url, … } per image), chosen with Select Slideshow Images
useFeaturedImagebooleanfalseUse the current post’s featured image as the background, at the size in responsiveSettings.{breakpoint}.featuredImageSize
responsiveSettingsobject(see below)Per‑breakpoint settings for spacing, typography, dimensions, etc.

responsiveSettings Structure

JSON
{
  "base":   { "enabled": true },
  "mobile": { "enabled": false, "customBg": false },
  "tablet": { "enabled": false, "customBg": false },
  "wide":   { "enabled": false, "customBg": false }
}

Each breakpoint can contain keys for padding, margin, fontSize, lineHeight, textAlign, height, minHeight, alignItems, border, borderRadius, bgImg, bgPosition, bgSize, bgRepeat, featuredImageSize, backdrop (a filter map for the shade overlay, see MethodBackdropControls) and boxShadow; zIndex and overflow at the base breakpoint, from Additional Options.


Control Sets

The Section block uses the following shared control components from lib/blocks/components:

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, mhGroup
MethodTypographyControlsTypographybase only—
MethodBorderControlsBorderbase, mobile, tablet, wide—
MethodShadowControlShadowbase only—
MethodBackgroundControlsBackground Media Optionsbase, mobile, tablet, wideincludeVideo and includeFeaturedImage on base; the panel also holds the Background Media selector (image / video or slideshow) and, in slideshow mode, hides the image controls
MethodColorControlsColorsglobaltextColor, linkColor, bgColor, bgShadeColor
MethodResponsiveTabsResponsivemobile, tablet, wideWraps per‑breakpoint controls
MethodAddtControlsAdditional OptionsbasezIndex, overflow
MethodBackdropControlsBackground Overlay Filtersbase, mobile, tablet, widebackdrop filters on .method-section-shade
MethodStyleTag——Generates scoped <style> for editor preview

Hooks

HookTypeArguments
useResponsiveSetterReact hook(attributes, setAttributes) — returns breakpoint‑aware setter function
useMergeRefsWP Compose hookMerges blockProps.ref with Jarallax ref to preserve toolbar functionality

Data & Dependencies

  • Vegas: inc/vegas/vegas-global.js (as a module) and vegas.min.css are enqueued for the slideshow background; the render prints the slides as data-vegas-slides on .method-section-bgimg and the slideshow fades between images on a 10-second interval.
  • Featured image: with useFeaturedImage the render reads postId from block context and prints get_the_post_thumbnail() at the base featuredImageSize as the jarallax-img, or resolves it per breakpoint through method_get_block_responsive_styles(); the editor preview uses the FeaturedImage component.
  • Jarallax: Both jarallax.min.js and jarallax-video.min.js are enqueued on all pages via method_section_enqueue_assets. Jarallax is initialized in the editor via a useEffect with retry logic (up to 20 attempts at 150ms intervals).
  • CSS Collector: Frontend CSS is generated by method_get_block_responsive_styles() and collected via method_collect_css(), which consolidates per‑block <style> tags into a single output.

Frontend Rendering

The PHP render callback generates a unique ID (uniqid('method-')), builds a CSS selector map, passes it through Method’s responsive style system, and outputs:

HTML
<div class="method-section" id="method-{id}">
  <div class="method-section-content {jarallax?}">
    {jarallax-img?}
    <div class="method-section-bgimg"> </div>
    <div class="method-section-shade"> </div>
    <div class="method-section-content-inner {constrained-classes?}">
      {inner block content}
    </div>
  </div>
</div>

The link color is applied with a:not(.method-theme-button), so Theme Buttons inside a section keep their own colors; zIndex and overflow are emitted on the wrapper, and backdrop as backdrop-filter on .method-section-shade.

When useParallax or bgVideo is set, the background image is rendered as an <img class="jarallax-img"> element instead of a CSS background-image. The method-section-content div gains a jarallax class and data-jarallax / data-video-src attributes.


Filters

This block does not currently expose dedicated PHP filters. Customization is achieved through CSS targeting the generated #method-{id} selectors.


Changelog

VersionDescription
2.0.0-alpha4Introduced (a09be88).
2.0.0-beta5Additional Options: zIndex at the base breakpoint, emitted on the wrapper (1a17d90).
2.0.0-beta6Use Featured Image background (useFeaturedImage, per-breakpoint featuredImageSize), postId / postType context, and the unused top-level bgSize and bgImgAlign attributes removed (09cc16b).
2.0.0-beta8Image Slideshow backgrounds through Vegas (bgMedia, images), inside a reorganised Background Media Options panel that hides the image / video controls in slideshow mode (bd7d2f4).
2.0.0-beta9overflow added to Additional Options and the wrapper’s CSS map (22945b6).
2.0.0-beta17Link color selector narrowed to a:not(.method-theme-button) (60b9b07); useParallax and unconstrained corrected from bool to boolean (b4c7dcb); editor margins between consecutive sections zeroed (.method-section and theme.json) (8db7ce9); Inserter title prefixed, “Method Section” (c34e9bb).
2.0.0-beta21Background Overlay Filters (MethodBackdropControls) on the shade overlay, base and responsive tabs (75910d2, 00817a3); .method-section-bgimg defaults to background-size: cover (75910d2).
2.0.0-beta22A new Section starts with a placeholder paragraph (“Section content goes here…”) (4f34c8b); Retitled “Section (Method)” and given the method keyword (93e1fcf).