API / Minn\Theme / QueryClasses

QueryClasses final readonly class

Minn\Theme\QueryClasses · public/minn/src/Minn/Theme/QueryClasses.php · 128 lines

The body-class tokens the main query stands for, in the reference's order (captured from the oracles): the view tokens (home, blog, privacy-policy, archive, date, search with its results token, paged, attachment, error404), then the singular's or the archive's own, then the numbered paging tokens. Flags combine as the query's do: a search inside a category carries both sets. The bare paged token follows the listing's page; the numbered ones follow a single's page too, and take the view's prefix in one precedence (single, page, category, tag, date, author, search, post type; the front and a plain taxonomy have none). A 404 carries no paging tokens. The theme renderers seat the numbered tokens after the embed token and add the template and theme tokens.

Constants and properties

privatereadonly Minn\Db $db

Promoted from the constructor.

Public

new__construct(Minn\Db $db)#
methodof(WP_Query $query): array#

The tokens for a main query.

@return list<string>

Internals 5

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

privateformat(int $id): string#

A post's format by its post_format term, standard without one (probe post-template-remaining).

privatesingular(WP_Post $post, WP_Query $query): array#
@return list<string>
privatearchive(WP_Query $query, mixed $object, int $id): array#
@return list<string>
privatepaging(WP_Query $query): array#

The numbered paging tokens: paged-N and the view's own.

@return list<string>
privatenamed(string $name, int $id): string#

A name as a class token, its id when nothing of it survives.