Repository navigation
Blocks Query Results
Block name: designsetgo/query-results
Added in: 2.1.0
Category: DesignSetGo
Block family: Query (parent) · Query Results · Query Pagination · Query Filter · Query Group Header · No Results
The Query Results block is the required direct child of a Dynamic Query block that renders the repeating item grid. It holds the item template — the set of inner blocks that define how each result looks — and owns the presentation attributes: columns, tag names, and group-by settings.
The reason this block was split out from the parent Query block is extensibility: by separating "what to query" (owned by the parent) from "how to lay out results" (owned by this block), the same query source and filter stack can power different output containers. When you insert a Slider or Scroll Slides block as a sibling of Query Results inside a Dynamic Query, those blocks can take over as the item host — iterating the same query items as slides or scroll panels — while the filters, pagination, and no-results blocks continue to work unchanged.
| Attribute | Type | Default | Notes |
|---|---|---|---|
tagName |
string | "ul" |
Outer list element: ul, ol, or div
|
itemTagName |
string | "li" |
Per-item wrapper element: li, div, or article
|
columns |
number | 1 |
Desktop column count |
columnsTablet |
number | 0 |
Tablet column count; 0 inherits desktop value |
columnsMobile |
number | 0 |
Mobile column count; 0 defaults to 1 |
firstItemColumnSpan |
number | 1 |
Column span for the first item (magazine/featured layouts) |
firstItemRowSpan |
number | 1 |
Row span for the first item |
groupBy |
object | null |
{field, key} — partition items; see Group-by
|
layoutVariant |
string | "" |
CSS class modifier (e.g. magazine, avatar-grid); applied as is-layout-<variant>
|
Column counts are emitted as CSS custom properties (--dsgo-query-columns, --dsgo-query-columns-tablet, --dsgo-query-columns-mobile) on the grid wrapper, driving a responsive CSS Grid layout defined in the block's stylesheet.
Tag name — outer wrapper element type.
Item tag — per-item wrapper element type.
Columns (Desktop / Tablet / Mobile) — responsive column grid. Tablet and mobile inherit desktop when left at 0 / 1.
First item column span / row span — creates a featured-item layout where the first result spans multiple columns and/or rows.
Group by — enables grouping; sub-controls appear for field (taxonomy, meta, date) and key (taxonomy slug, meta key name, or date precision Y / Y-M / Y-M-D).
Layout variant — free-text field that adds an is-layout-<variant> CSS class to the grid wrapper for scoped per-variation styles.
The inner blocks of Query Results define the per-item template. During server rendering:
- The parent Query block runs the query and iterates results
- For each item, it renders the inner blocks with the item's
postId/postType(for posts) ordesignsetgo/currentItemId/designsetgo/currentItemType(for users/terms) injected into block context - The rendered HTML is wrapped in the
itemTagNameelement with classdsgo-query__item - The accumulated HTML is stashed in a PHP global and picked up by this block's
render.php
This architecture means the parent runs one WP_Query and populates the per-request state registry before any child block renders, so sibling pagination and no-results blocks can read the correct totalPages and totalItems without re-executing the query.
The editor preview uses a "first item editable, rest server-rendered" model:
-
Item 0: editable
InnerBlocks— the block template the author designs. Changes here are reflected immediately via the standard editor experience. - Items 1..N: read-only HTML fetched from the same PHP render pipeline used on the frontend. This ensures exact editor-to-frontend parity: fluid spacing presets, block supports padding, style bindings, and dynamic tags all resolve identically to what visitors see.
While the server render for items 1..N is in flight, a BlockPreview fallback renders those positions using the current inner blocks as a best-guess approximation.
When source is manual or current, the live preview is skipped (manual has no query to run; current binds to the viewed post context which doesn't exist in the editor canvas).
When groupBy is set, the Query Results block partitions results before rendering. The Query Group Header block — when present anywhere in the item template — is extracted from the template, rendered once per group with designsetgo/groupLabel and designsetgo/groupValue context, and prepended to that group's items. Each group is wrapped in:
<section class="dsgo-query-group" data-dsgo-group-value="...">
<!-- group header HTML -->
<!-- item HTML -->
</section>If groupBy is set but no Query Group Header block is found in the template, the editor shows an informational notice and the frontend renders items without group wrappers.
When a Slider or Scroll Slides block is placed as a direct child of the parent Dynamic Query block alongside a Query Results block, it acts as the item host instead. The Query block detects the first registered item host in its child list and renders items into that host's template. The item wrapper (itemTagName) is set to "none" automatically so the host's own slide element is not double-wrapped.
A third-party block can register itself as an item host via the designsetgo_query_item_host_block_names filter (see Developer Hooks).
During filter and pagination refreshes, the item grid container receives aria-busy="true". The block stylesheet uses this attribute to show a CSS-only loading skeleton — a set of animated placeholder shapes that indicate content is loading — without requiring any JavaScript animation.
[aria-busy="true"] .dsgo-query__item { /* skeleton styles */ }The skeleton is purely CSS: no extra DOM nodes, no JavaScript timers.
The block renders as:
<ul class="dsgo-query-results dsgo-query-results--source-posts is-layout-magazine"
style="--dsgo-query-columns:3; --dsgo-query-columns-tablet:2; --dsgo-query-columns-mobile:1;"
data-dsgo-query-results-role="container"
data-dsgo-query-id="abc123">
<li class="dsgo-query__item"><!-- item template --></li>
<!-- … -->
</ul>The data-dsgo-query-results-role="container" and data-dsgo-query-id attributes are used by view.js to scope DOM operations (appending new items, aria-busy toggling) to the correct grid when multiple Query blocks exist on one page.
- The grid element uses the
tagNamechosen by the author;ul(default) andolare semantic list elements that expose the item count to assistive technology - When infinite scroll is active, the grid receives
role="feed"and each item getsaria-setsize/aria-posinsetattributes stamped bydsgoStampFeedPositions() -
aria-busy="true"is set during refreshes; screen readers are notified when loading completes
- Dynamic Query — the required parent container
- Query Group Header — renders once per group inside grouped results
- Query Pagination — page navigation sibling
- Query Filter — filter controls sibling
- No Results — zero-result fallback sibling
- Slider — alternative item host for carousel-style output
- Scroll Slides — alternative item host for scroll-driven output
Auto-generated from
docs/blocks/QUERY-RESULTS.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