# Query

The `query` block is an Archive post layout that sets the options to show and categorise single posts. The `query` block is a vital part of every block-based theme and further customisations always start with the `query` block.

The `query` block requires a collection of same category posts so it is important to have these before you build your `query` block.

{% hint style="info" %}
It is recommended to add a `query` block inside a Section.
{% endhint %}

<figure><img src="https://lh6.googleusercontent.com/aQoQVRs-xv74Ksbek96fky15X0IyjlMHLbGU_Y9n58bBgdPqX0vIx05vw3tJ8N7Mmgyt8bJlyyJh87oVipb0WAaTn6iry30H7B_sBCDvqfaj4wWtmHkthdIUvdD-j9AJD6s46OaCYZH6r82rBjklmSib4evD964pOmHp4ftWtj0RNNp5Z9QiEi3Z2GeFBA" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh4.googleusercontent.com/vyCjdOjmXAISH6-nPGVO_ZzXyUkcnslzoKPH0rS8KH_OPdkiNJyXlP5D_KGdOgvzM112PUvt-Z-dMz7tk0lFCxK0q_bOpRKLVY0Eo0eo39IT8D02ICUEvmPnhzeGsziSLeZ31jSFU5sSbmIvNTofwY0zub68nIIEJynP6KZGc5hN5s8Nm-FBhyYOGF7H" alt=""><figcaption></figcaption></figure>

<details>

<summary><strong>Add</strong></summary>

1. Open the Inserter Panel&#x20;
2. Search for the <img src="/files/sHJscThWb2nW7KToY5IY" alt="" data-size="line"> `query` block
3. Click on the block to insert it into your parent block

</details>

After you add the `query` block, a modal will appear to remind you that you have to add a Query Template to a `query` block.

To add a Query Template, click on the button.

If you want to add a Pagination Wrapper (a container for page numbers), remember to add this by clicking the button before you add a Query Template.

<figure><img src="https://lh6.googleusercontent.com/JBWSGp4rXNRT6zcgDFPLZJg9W0XRbNoqMV37e4Z81RebZ2gU-x5diiG7cda2dy5XSWq9QAICDU45N-VDiSH16cZxbVCr5CsZ4i6hVl8Gxlg9QjHDgf9qwQCzgxRaBtUcSK9Jh9AxF9lcxxF6xAYV96wrrzevnPu03GuogxatWd9msN1Eq2T1WZsbpnu3Jw" alt=""><figcaption></figcaption></figure>

Once you have added the Query Template, another modal will pop up and guide you to the block inserter to add the blocks you require to the Query Template.

<figure><img src="https://lh6.googleusercontent.com/m7YCK2UoSIIQscAlpHYDVyI-5-1fiHWRnY39cCG_78vH0CTdu9lhG2FB1z0vPfD32hC-Mb7nAvYeU27KYUKDkLSHVVrftfa2furvXnL4-xpeZXbUackc-wskdlubPPbmH1uqQpnL-gKsAxpMJMKWym7-nGFmGdMcRvHOWHLVXia6iOhNcHcYkE81ThPbcA" alt=""><figcaption></figcaption></figure>

## Add Pagination Wrapper

The Add Pagination Wrapper opens a `pagination` Block inside your Query Template and opens a Pagination Placeholder.

<figure><img src="https://lh4.googleusercontent.com/KsB1YV_-2p-rjoKnD6XaRs65xUuqfdL_0I8Gta6Jm8VlJ5qqwPoolCddw-vN0MHbrEKvPrtvA4VN8TWmwEA5GQerQTP52CGZ0lUGu_YtxQP9gAdmnXszTJWFUdSElz3Mf-pIObN0VMAO_Noz3nAYCRVWq5QBJXCYjOwXS1Ay2WkisFkxfsSZ8Gc3nMbGSg" alt=""><figcaption></figcaption></figure>

The Pagination Placeholder allows you to add page numbers to your Query Template - "Add Pagination Numbers" -  or to cancel them with the "dismiss button".

<figure><img src="https://lh4.googleusercontent.com/jmO9hbaKmPcJiNs4gKHto072y9OsJwZJ6v0Mi7sNY_F6I5-Qd8w41-gsuxTpBhLE-LpOLFGGGNxitz81npSOWhqRIQg_rfwkx3wWXl8b_SwmrcPqtmtrxXQ-XaFdkW6gk5s0ZDc4nMz7x5Yod8ONpTBnEnM5dLhhCCd3lgU0nRu71WBBaTdoUG6DEu3TgQ" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh6.googleusercontent.com/bGWzrqVNxRvexf1F6elHg3-u_3RMRcpvb4tQviNbAI1Fmxo-amu9RzS_VwyY5rc8GLGfBee4WP0nvLfcGbuXm1Ual3B8WlyNSG9ZcD0YwT-EXfcR-b4dl0diZzbhdM8gYH1UH2NLj6ac3uI-TMGNGif-OzBxyWfpOrEGLJwk9I4dloug4o0XLWJxvTJphg" alt=""><figcaption></figcaption></figure>

{% embed url="<https://www.youtube.com/watch?index=9&list=PLvp2KVaJroeRvQkxxD5I6hciYc1fOJzpC&v=7W7YGnF2K0k>" %}
TTD #9 - Queries
{% endembed %}

## Query Settings

The Query Settings panel is where the query's properties are listed and the steps that can be applied to it.

<figure><img src="https://lh5.googleusercontent.com/oOCdV0NfHgLJPRZaLL93yIenqTvgASQdEL2R4AgoHFCZ7wmkYPJZ1f6YN_nFSOkDimW-yN8UK3-vt-j-L67uLJX74n_NmlKggQ55uqRxtqoYckunHcj7YySrdUw28SDZlPwlAtS2HUW09Gpe75uBRdl-wk2maQ56b9aJCkROaQIbZH0QEvZHNmS4X-LpAA" alt=""><figcaption></figcaption></figure>

{% content-ref url="/pages/eLKHLfR1bXvGPs1Gsvru" %}
[Query Settings](/blocks/query/query-settings.md)
{% endcontent-ref %}

## Query Editor

The Query Editor helps you to construct and modify a Wordpress Query using a structured format in which you can interactively select components.There are 4 main Query types : Post Types, Terms, Users and Products.

You can also export your Query elsewhere by copying and pasting the generated code.

<figure><img src="https://lh6.googleusercontent.com/dceEPLRErSuem0h2kbYzQyPzRbsuNBUZPN6Ox9OMQ6K0WAMp5vA0VPk1c1rosmEaXBebXR95jYmJ86Hlwy603MKiTfTQ_zv9I1_RRzXLCO6hCu9GkJo2lIMa8H7Q39mT-HJ6FiRkw0zc2_GJ7f48Q-J73GFNSy-_-Nsi-sWy8LPu85-KMsxoVqfjfrb6JA" alt=""><figcaption></figcaption></figure>

<details>

<summary>Open</summary>

1. Click on the ➕ ​​icon to open the Inserter Panel
2. Select <img src="/files/sHJscThWb2nW7KToY5IY" alt="" data-size="line"> `query` block
3. Open the Block Inspector
4. Navigate to the Primary tab
5. Find Query Editor icon
6. Click to open Query Builder Modal

</details>

{% content-ref url="/pages/x1M0oYM3NnbhcAGJNIq6" %}
[Query Editor](/blocks/query/query-editor.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cwicly.com/blocks/query.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
