Repository navigation
Plans 2026 04 21 Query Capable Layout Blocks Design
Date: 2026-04-21
Branch: claude/query-block-onboarding-placeholder
Status: Design validated, pending implementation
The Dynamic Query family (designsetgo/query + siblings) today renders results through one item host: designsetgo/query-results, which lays items out as a grid/list. Other layout blocks (designsetgo/slider, designsetgo/scroll-slides, and eventually more) are structurally identical — chrome + N authored item children — and would benefit from consuming query data. We need a reusable contract so any "chrome + N items" block can be a query item host without duplicating data-config UI or query plumbing.
Composition shape: inside-query. Authors compose
designsetgo/query > designsetgo/<layout> > designsetgo/<item>
The query container owns data config (post type, filters, sort, date/tax/meta queries, relationship, grouping). The layout block owns chrome (arrows/dots/autoplay for slider, pinned nav for scroll-slides). The item block is the iteration template.
Detection: implicit via block context. A layout block is in query mode iff designsetgo/queryId is present in its inherited context. No new attribute, no toggle. In-query = bound; anywhere else = authored (today's behavior, unchanged).
Template rule: exactly one child when in query mode. Editor enforces via allowedBlocks + a prune effect on first detection. Server render treats that one child as the per-item template.
Split designsetgo_query_render() into two helpers in src/blocks/query/render-helpers.php:
-
designsetgo_query_render_items( $query_id, $template_block, $context )— reusable core. Runs the resolved query (posts / users / terms / relationship), pushes$GLOBALS['designsetgo_parent_stack']per iteration, renders the template block N times viadesignsetgo_query_render_item(), returns concatenated HTML with no outer wrapper. -
designsetgo_query_render()— kept as-is forquery-results. Refactored to calldesignsetgo_query_render_items()internally and add its existing.dsgo-query-resultswrapper + sidecar around it. Zero behavior change.
Layout blocks' render.php shape:
if ( ! empty( $block->context['designsetgo/queryId'] ) ) {
$template = $block->parsed_block['innerBlocks'][0] ?? null;
$items_html = designsetgo_query_render_items(
$block->context['designsetgo/queryId'],
$template,
$block->context
);
return designsetgo_slider_wrap_chrome( $attributes, $items_html, $block );
}
// else: authored branch — render innerBlocks as todaySidecar. Extract [data-dsgo-blobs-for] emission into designsetgo_query_emit_blobs_sidecar() so every query-capable layout block calls it once after its chrome wrapper. Keeps IAPI filter/pagination flows identical whether the host is query-results, slider, or scroll-slides.
Extract the existing query-results/edit.js preview logic into a shared hook:
useQueryPreviewItems({ queryId, template, count }) in src/hooks/useQueryPreviewItems.js. Returns { items, status }. Internally handles the posts (useEntityRecords) / users / terms / relationship split and parent-stack emulation so nested bindings preview correctly.
Per-layout edit.js pattern:
const boundToQuery = !!queryId;
if ( ! boundToQuery ) {
// authored branch — useInnerBlocksProps on children, unchanged
}
const { items } = useQueryPreviewItems({ queryId, template, count: perPage });
return (
<div {...blockProps}>
<SliderChrome {...chromeProps}>
{items.map((item, i) => i === 0
? <InnerBlocks /* editable template */ />
: <BlockPreview blocks={template} context={item.previewAttributes} />
)}
</SliderChrome>
</div>
);query-results/edit.js refactors to consume the same hook; no visual diff.
The query container permits filter / pagination / group-header / no-results as siblings of the item host. With slider/scroll-slides as the host:
-
Filters, sort, search, active, reset — unchanged. IAPI
setFilterrebuilds slide set; slider/scroll-slides re-init on DOM mutation. - Numbered pagination — works, but UX clashes with slider's own arrows. No guard; author's call.
- Load-more — works well ("swipe to end, click load more, slides append").
-
Infinite (v2.2) — recommended pairing for slider. IntersectionObserver on sentinel inside slider container triggers
loadMoreon last visible slide. - Group-header (v2.3) — supported with scroll-slides (group heading = pinned section). Not supported with slider; documented, not blocked.
- No-results — works identically.
Net-new UI: none. No inspector toggles, no attributes. All behavior is author composition.
Zero breaking changes. The query-mode branch is purely additive — entered only when designsetgo/queryId context is present. Existing authored sliders and scroll-slides keep identical save output, same view.js, same attributes. No deprecations.
Per participating layout block, one block.json change:
"usesContext": [
"designsetgo/queryId",
"designsetgo/currentItemId",
"designsetgo/currentItemType"
]Query container allowedBlocks extends from [query-results, query-filter, query-pagination, query-no-results, query-group-header] to also permit [slider, scroll-slides] as valid item hosts.
-
Extract shared primitives.
designsetgo_query_render_items()(PHP) anduseQueryPreviewItems()(JS). Refactorquery-resultsto consume them. Confirm zero visual diff against current renders. This is the foundation; everything after reuses it. -
Wire slider as first participant. Add
usesContext, add query-mode branch toedit.js+render.php, enforce single-template child viaallowedBlocksonslide+ prune effect. Validate across posts, users, terms, relationship. - Wire scroll-slides. Mechanical repeat of step 2. If it's not mechanical, the abstraction is leaking — fix the primitive, not the second block. This is the payoff test.
-
Docs. Update
.claude/docs/QUERY-BLOCK-GUIDE.mdwith the "making a layout block query-capable" recipe so future blocks can be added by pattern-matching.
- Mixed mode — leading static children + template marker. Real future ask; deferred.
- Non-list layout blocks — sticky-sections, marquee, timeline don't have a clean "one template child" shape yet. Not in scope until the pattern is proven on slider + scroll-slides.
- Cross-block authoring aids beyond the prune effect (drag-and-drop conversion, one-click "make dynamic", etc.).
Auto-generated from
docs/plans/2026-04-21-query-capable-layout-blocks-design.md. To update, edit the source file and changes will sync on next push to main.
- Accordion
- Advanced Heading
- Blobs
- Breadcrumbs
- Card
- Chart
- Comparison Table
- Countdown Timer
- Counter Group
- Divider
- Dynamic Image
- Fifty Fifty
- Flip Card
- Form Builder
- Grid
- Hotspot
- Icon
- Icon Button
- Icon List
- Image Accordion
- Map
- Modal
- Modal Api Reference
- Modal Auto Triggers
- Modal Fse Compatibility
- Modal Gallery Navigation
- Modal Trigger
- Pill
- Product Categories Grid
- Product Showcase Hero
- Progress Bar
- Query
- Query Filter
- Query Group Header
- Query No Results
- Query Pagination
- Query Results
- Row
- Scroll Accordion
- Scroll Marquee
- Scroll Slides
- Section
- Section Divider
- Slider
- Star Rating
- Sticky Sections
- Table Of Contents
- Tabs
- Text Path
- Timeline
- Background Video
- Block Animations
- Clickable Group
- Conditional Visibility
- Custom Css
- Draft Mode
- Dynamic Tags
- Expanding Background
- Grid Mobile Order
- Grid Span
- Hover Effects
- Max Width
- Responsive Visibility
- Reveal Control
- Scroll Parallax
- Sticky Header
- Style Binding
- Svg Patterns
- Text Alignment Inheritance
- Text Reveal
- Abilities Api
- Abilities Api Guide
- Block Bindings
- Draft Mode Api
- Form Webhooks
- Generation Contract
- Interactive Blocks
- Layout Flexibility
- Markdown Content Negotiation
- Rest Api Reference
- Wp Cli Reference
- Ai Assisted Development
- Best Practices Summary
- Block Controls Organization
- Block Development Best Practices Comprehensive
- Block Exclusion Guide
- Deploying To Wordpress Org
- Design System
- 2026 04 16 Blocks Editor Ux Design
- 2026 04 17 Theme 3 Inspector Ia
- 2026 04 21 Query Block Onboarding
- 2026 04 21 Query Capable Layout Blocks Design
- 2026 04 27 Block Roadmap Ideas
- 2026 07 01 Shape Divider Theme Inheritance
- 2026 07 02 Icon Block Dynamic Render Pilot
- 2026 07 06 Section Divider Block Design
- 2026 07 06 Section Style Variations Fse Design
- 2026 07 06 Section Styles Editor Preview
- 2026 07 07 Row Grid Overlay Hover Parity Design
- 2026 07 21 Conditional And Dup Label Sourcing
- 2026 07 23 Theme Block Type Animation Defaults
- 2026 08 16 Chart Block
- 2026 08 16 Greenshift Gap Roadmap
- 2026 08 17 Woocommerce Surface
- 2026 08 24 Loop Carousel
- 2026 08 24 Star Rating Block
- 2026 09 17 Abilities Drift Prevention
- 2026 09 17 Abilities Drift Prevention Implementation
- 2026 09 29 Existing User Regression Fixes
- 2026 09 29 Release Preflight Fixes
- Readme
- 2026 07 02 Block Authorability Audit
- 2026 09 29 Regression Fixes
- 2026 09 29 Release 2.9.0
- 2026 09 29 Release Fixes
- 2026 10 19 Bug Hunt
- 2026 10 20 Bug Hunt Round 2