Query

The Query element is not an HTML element but a fragment, and therefore it cannot be styled. This element is used to fetch specific data types (such as Posts, Comments, Menu items, Terms, and Users) from the database and pass them to its child elements. For example, a Query element can be used on a product page to access product information.

By adding a Query element to the top section of the product information and activating the ‘Default Query’ option, you can facilitate the retrieval of relevant product details. The Query element always returns results as an array. To access and organize this data, a ‘loop’ element must be used.

Example Usage:

  1. First, add a Query element to your page.
  2. Then, insert a ‘loop’ element within this Query element.
  3. In the ‘Settings’ section of the ‘loop’ element, select the Query element you added as the ‘Source’.
  4. Once you complete this process, a ‘loop’ element that repeats for each relevant data item is created. For example, you can add a ‘heading’ within the ‘loop’ element and assign it the ‘post title’ data, resulting in a sequentially listed set of product titles.

This feature is extremely useful for the management and presentation of dynamic content.

For more information on the Loop element and its usage, you can refer to this article.