How to use it
- Build the replacement card as a Bricks template. Its type must be Section or Content, and it must be published.
- Select the Container, Block or Div that has the query loop.
- Under the Query control, set Alternate template every N items (Kiln). With 3, the 3rd, 6th and 9th item
use the template. To place it at chosen items instead, fill Or at these positions, for example
3, 7. One number places it once. - In Alternate template, pick your template. The list is searchable.
- In Template placement, choose whether it replaces the item (the default) or comes after the item. After the item, every post still shows: with 3, the template sits between the 3rd and 4th post.
- In a grid, Template spans columns and Template spans rows make the card wider or taller. Both take a value per breakpoint, so a card two columns wide on desktop can be one column on phones.
Where it appears in Bricks
Container, Block, Div, Content tab, directly under the Query control. The fields show only while the element has a query loop.
How it works with your loop
- The template renders with the loop item as the current post. Dynamic data inside the template, such as the post title, reads that item.
- Kiln wraps the template in a
divwithdisplay: contentsthat carries the loop element'sbrxe-class and akiln-alt-itemclass. The template's root stays the grid or flex item, with its own styles. Bricks needs the class to clear old results when a filter or AJAX pagination refreshes the loop, and to know where to add the next page. - Infinite scroll keeps loading when a page ends on a template card. Kiln adds a small script for that, only on pages where such a loop has infinite scroll on.
- The count starts after your loop's offset. With an offset of 2 and N set to 3, the 3rd card you see is the first swapped one.
- The count continues across load-more and infinite-scroll pages for post, term and user loops. Loop types from other plugins that don't report their page position count from 1 on every page.
- On a site with WPML, Kiln uses the translation of the template that matches the page language.
Limits
- The builder shows your normal cards. Kiln swaps the template on the front end only.
- A template and either N or a positions list need a value. Without them the loop renders as usual.
- A template that is not published, or is not a Section or Content template, is ignored.
- Do not use it on a loop inside a Nav element. The swapped item does not keep the list-item wrapper.
Settings
None. Turn the module on in Bricks > Kiln (it is on by default).
Requirements
Bricks 2.4 or newer.