The Lyquix theme includes 13 layout blocks based on CSS layout primitives. These blocks provide structural containers that wrap inner blocks (Gutenberg InnerBlocks) and apply CSS layout patterns using Tailwind CSS classes.
| Block | CSS Pattern | Purpose |
|---|---|---|
| Box | Padding/spacing | Basic container with configurable padding |
| Center | margin-inline: auto |
Horizontally center content with max-width |
| Cluster | Flexbox | Group items with flexible wrapping and gap |
| Container | Max-width + padding | Full-width container with centered content |
| Cover | Flexbox + min-height | Full-height cover layout with centered content |
| Frame | Aspect ratio | Maintain aspect ratio for media content |
| Grid | CSS Grid | Multi-column grid layout |
| Icon | Flexbox | Icon paired with text content |
| Imposter | Position: absolute | Overlay/floating element positioning |
| Reel | Overflow: auto | Horizontal scrolling container |
| Sidebar | Flexbox | Two-column layout with main content and sidebar |
| Stack | Flexbox column | Vertical spacing between child elements |
| Switcher | Flexbox wrap | Responsive layout that switches from row to column |
All layout blocks are registered under the Lyquix Layout Blocks category in the Gutenberg editor.
Layout blocks serve as wrappers for WordPress InnerBlocks. They:
- Provide a structural container element
- Apply CSS layout classes (primarily Tailwind utilities)
- Allow configuration through ACF fields
- Support nesting for complex layouts
Layout blocks use a special convention: ACF fields prefixed with tailwind_ are automatically converted to CSS utility classes. This is handled by \lqx\layouts\get_tailwind_classes():
// If an ACF field has:
// key: "tailwind_p-"
// value: "4"
// It generates the class: "p-4"
// If an ACF field has:
// value: "tailwind_text-center"
// It generates the class: "text-center"The function walks through all ACF fields for the block and:
- For string values starting with
tailwind_: strips the prefix and uses the remainder as a class - For string keys starting with
tailwind_with a truthy value: strips the prefix from the key, appends the value, and uses the result as a class
Each layout block in php/layouts/ contains:
php/layouts/{block-name}/
├── block.json # Block registration
└── default.php # Render function
The render function typically:
- Gets the Tailwind classes from ACF fields
- Renders the inner blocks within a wrapper element
- Applies the CSS classes to the wrapper
<div class="stack gap-4 p-2">
<!-- InnerBlocks content -->
<div>Block 1</div>
<div>Block 2</div>
<div>Block 3</div>
</div>- Add a layout block from the Lyquix Layout Blocks category
- Configure its settings (spacing, alignment, etc.) in the block sidebar
- Add inner blocks inside the layout block
- Layout blocks can be nested for complex structures
Centered content with max-width:
Container > Center > Stack > [Content blocks]
Two-column layout:
Sidebar > [Main content] + [Sidebar content]
Card grid:
Grid > [Card 1] + [Card 2] + [Card 3] + ...
Hero with overlay:
Cover > [Background image] + [Text content]
Horizontal scrolling gallery:
Reel > [Image 1] + [Image 2] + [Image 3] + ...
Adds padding around its content. Configure padding values through Tailwind utility fields.
Centers content horizontally with a configurable max-width. Uses margin-inline: auto.
Groups items using flexbox with wrapping. Items flow horizontally and wrap to new rows. Configure gap, alignment, and justification.
A full-width wrapper with horizontal padding and centered content. Commonly used as the outermost layout block.
Creates a full-height section with vertically centered content. Useful for hero sections and banners. Set a minimum height and center content within.
Maintains a specific aspect ratio. Useful for embedding media (video, maps) where you need consistent proportions.
CSS Grid layout with configurable columns. Set the number of columns, gap, and responsive behavior.
Pairs an icon (image or SVG) with text content side by side. Configure icon size and alignment.
Positions content absolutely over its parent. Used for overlays, tooltips, and floating elements. Configure position offsets.
Creates a horizontal scrolling container. Items are laid out in a row and overflow horizontally. Useful for horizontal card carousels without JavaScript.
A two-panel layout with a main content area and a sidebar. Configure which side the sidebar appears on and its width.
Adds consistent vertical spacing between child elements. The most commonly used layout block. Configure the gap between items.
A responsive layout that shows items in a row when there's enough space, and switches to a column layout when the viewport is narrow. Configure the threshold and number of items.
The layout blocks are powered by the tailwind-layouts package, which provides Tailwind CSS utilities specifically designed for these layout patterns. The plugin is configured in css/tailwind/config.js:
plugins: [
require('@tailwindcss/container-queries'),
require('@tailwindcss/aspect-ratio'),
require('tailwind-layouts'),
]By default, ACF wraps inner blocks in an additional <div>. The Lyquix theme disables this for all lqx/ blocks to give you full control over the HTML structure:
add_filter('acf/blocks/wrap_frontend_innerblocks', function ($wrap, $name) {
if (str_contains($name, 'lqx/')) {
return false;
}
return true;
}, 10, 2);