API / Minn\Blocks\Dynamic\Theme / QueryBlocks

QueryBlocks final class

Minn\Blocks\Dynamic\Theme\QueryBlocks · public/minn/src/Minn/Blocks/Dynamic/Theme/QueryBlocks.php · 343 lines

query, post-template, query-title, query-no-results, query-pagination, query-total.

Constants and properties

privatearray $queries
privatereadonly Minn\Content\Site $site

Promoted from the constructor.

privatereadonly Minn\Front\Permalinks $permalinks

Promoted from the constructor.

Public

new__construct(Minn\Content\Site $site, Minn\Front\Permalinks $permalinks)#
methodregister(Minn\Blocks\Renderer $renderer): void#

Registers this family's blocks with the renderer.

Internals 13

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatequery(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

The query wrapper is stored markup; the block sets the loop its children read, run only once one of them asks (a post template, pagination, no results, the total), as the reference runs it in those blocks: a query block with nothing that lists posts queries nothing (security review 2026-10-22).

privatequeried(Minn\Blocks\Block $block, array $attrs, int $page): array#

A query loop's posts as the reference finds them: the arguments build_query_vars_from_query_block makes of the block's query (through query_loop_block_query_vars) for the page its query-{id}-page asks for, run through WP_Query, so pre_get_posts and the posts_* filters shape it too.

$attrsarray<string, mixed>the block's query
@return array{Page, Query}
privatepage(Minn\Objects\Query $query): Minn\Content\Page#

A query's posts as a page of records.

privateloop(Minn\Blocks\Block $block, array $attrs, Minn\Blocks\Renderer $renderer): array#

A loop as the query block sets it: the main query's page when it inherits, else its own query for the page its query-{id}-page asks for. An inheriting loop inside the main query's loop (a singular page's template, a post's content in a listing) walks a copy of the main query from its start, as the reference does (no query runs again), so it shows the main query's posts rather than finding that loop already under way.

$attrsarray<string, mixed>the block's query
@return array{page: Page, query: ?Query, inherit: bool, paged: int, perPage: int, id: int}
privatecurrent(?Minn\Blocks\Renderer $renderer = NULL): array#

The innermost loop being rendered; outside one, the loop a block's context provides (a post template called by its render callback).

privatetotal(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

How many posts the loop found, or which of them this page shows (displayType range-display).

privatepostTemplate(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

The loop's posts, walked as the reference walks them: the loop's query is asked whether it has posts (an empty one fires loop_no_results), each post is set up with the_post (loop_start before the first, loop_end after the last), and the main query's post is set up again once the loop is done. Plugins see the global post and in_the_loop() move with the loop.

privatequeryTitle(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#
privatenoResults(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#
privatepagination(Minn\Blocks\Block $block, Minn\Blocks\Renderer $renderer): string#

Pagination renders only when the loop it belongs to has more than one page: the main query's pages for an inheriting loop, its own query's (as many as the block's page limit allows) for any other, paged by query-{id}-page. The links keep the address's other arguments; the numbers show the first and last page and those around the current one, dots between (probe query-pagination-custom).

privatepaginationBase(Minn\Blocks\Renderer $renderer): string#

The current listing's own URL, without a page number.

privatenumbers(int $paged, int $pages, callable $link, int $around): string#

The page numbers: the first and last page, and those within $around of the current one, with dots where pages are left out.

$linkcallable(int): string
privatearchiveTitle(array $type): string#

A post type archive's title: the type's label, renamed by the post_type_archive_title filter when a plugin does.