23rd Jun '23/14 commentsBricks Query Loop – How to Insert Elements After Every Nth PostSridhar Katakam Update: Follow this tutorial instead. This Pro tutorial provides the steps to output element(s) in a Bricks' query loop after every nth post. Use case: Show an ad after every 3rd post. This is based on the previous How to Insert Element(s) Between Query Loop Posts in Bricks tutorial. It is possible to apply display: grid to the query loop element's parent if a grid layout is needed. Note This might break pagination. Implement this only for a non-paginated list of posts. Step 1 Let's define a couple of custom functions for getting the loop index and the modulus of loop index. Add the following in child theme's functions.php or a code snippets plugin: This is a BricksLabs Pro tutorial. For full access login below or create your BricksLabs Pro account Username Password Remember Me Forgot Password Tagged: BricksLoop IndexProSridhar KatakamSridhar Katakam is a Bricks enthusiast. He likes helping others by researching and solving WordPress-related problems and building websites.Get access to all 633 Bricks code tutorials with BricksLabs Pro
Pro ACF Select Field Query Types in BricksIn the BricksLabs Facebook group a user asks: Hi all, I am building a single post template for a CPT and want to know if…Read more →Categories: Bricks, Plugins, ProTags: ACF, Custom Query Type, Query Loop
How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 3)This tutorial provides the PHP & JS codes that can be pasted in order to filter your markers on a map each time you digit…Read more →Categories: Bricks, Free, PluginsTags: ACF, Animations, Filters, Isotope, Leaflet, Maps, Query Loop
Pro Parent post Bricks query loopUpdated on 5 Feb 2024 In the BricksLabs Facebook group a user asks: Is there a way to output the data of a parent post…Read more →Categories: Bricks, ProTags: Query Loop
Latest Featured Posts First in Bricks Query Loop (No Duplicates)In the Bricks Facebook group a user asks: We can use AI to help unfreeze our brains sometimes or at least have it write the…Read more →Categories: Bricks, FreeTags: Query Loop
Pro Excluding Duplicate Posts from Query Loops in BricksHow to ensure that posts are not duplicated when two query loops are used on the same page.Read more →Categories: Bricks, ProTags: Query Loop
Pro How to Insert an Ad or an Element Between Posts in BricksHow to insert an image or any Bricks element between posts output by a query loop.Read more →Categories: Bricks, ProTags: CSS Grid
Querying Posts by Date Field to Exclude Past Events with ACPT PluginIn the Bricks' Facebook group, a user asked: Meta query? What am I missing?Hi all, really need a little guidance on this one. I have…Read more →Categories: Bricks, Free, PluginsTags: ACPT, Query Loop
Pro Nested Query Loops with Dynamic Author Filtering in BricksThis Pro tutorial provides the steps to set up nested query loops in Bricks for grouping posts by their authors. For the posts under each…Read more →Categories: Bricks, Plugins, ProTags: BricksExtras, Nested Queries, Pro Accordion
Pro Events grouped by Event Date custom field in BricksThis Pro tutorial for Bricks users provides the steps to output posts of an event custom post type dynamically grouped by the value of their…Read more →Categories: Bricks, Plugins, ProTags: ACF, Nested Queries