Query Block

Description

A Query Block, or Query Loop, is an advanced block that loops WordPress posts into a display based on different query parameters and visual configurations. You can use a Query Block to display content of a like type that exists as a post – the most popular use is for blogs, case studies or projects, services, locations, or products. But your Query Block will be unique to your site’s needs, and may include a custom post type like people, hotels, or many more possibilities.

Settings

Query Block Settings

Inherit Query from Template (Toggle)

This setting allows you to use the global query context that is set with the current template, such as an archive or search. Disable this toggle to customize the settings independently. If enabled, you won’t see most of the other settings mentioned below.

Post Type

This option lets you choose what type of post content the query should pull. Pages are not able to be queried. The dropdown options will depend on the content types that exist in your WordPress site as a post.

Items Per Page

This setting controls how many posts will be shown per page. If you have more content than the items per page setting, that content will appear on further pages. See more about Pagination.

Offset

This has rare uses, such as having two Query Blocks for the same content type to suit your design. You can choose to offset one of the blocks, and it will effectively hide one post per numeric value. This way, the two blocks could show different posts instead of being identical.

Max Page to Show

This option allows you to control the maximum number of pages shown in the pagination. It’s unlikely you would want to do this, as the Pagination Block automatically shows the number of pages needed for the amount of content, based on your Items Per Page setting (above).

Order By

Use this dropdown to set how the Query Block displays content: newest to oldest, oldest to newest, A to Z, or Z to A.

Sticky Posts

Blog posts can be “sticky”, a feature that pins them to the first position on the landing page even when new content is published. Select from the dropdown if you would like Sticky Posts included, excluded, or to be the only content queried.

Filters

Use this setting to filter out (exclude) posts by categories or keywords. This will automatically exclude all content that matches this parameter from being pulled into your Query Block.

Advanced

Override Automatic Query ID Generation

If enabled, this toggle would override the automatic query ID, which is how the Query Block interprets parameters.

HTML Element

This allows you to change the HTML element that Query Block is in.

HTML Anchor

This field allows you to create a unique web address for the block, allowing you to link to this specific section of the page.

Additional CSS Class(es)

This allows you to enter a unique Class identifier, for custom CSS targeting within the theme to faciliate custom development. More about Theme Customizations.

It also enables the use of Foundry utility classes. More about Utility Classes.