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 How to Query WordPress Taxonomy Terms by Hierarchy Level in BricksHow to limit the terms of a Bricks Terms query to only those at a specific level within the taxonomy hierarchy.Read more →Categories: Bricks, ProTags: Terms Query
Pro Alphabetical Glossary Query Loop in BricksHow to group posts (can be of any post type) by their starting letter in Bricks.Read more →Categories: Bricks, ProTags: Custom Query Type, Nested Queries, Query Loop, Tabs
Pro Querying Posts by ACF Date Sub Field in BricksUpdated on 17 Nov 2023. This Pro tutorial shows how we can set post__in query parameter of a query loop in Bricks to an array…Read more →Categories: Bricks, Plugins, ProTags: ACF Pro
Pro Query Loop in BricksThis Pro tutorial walks you through the steps to use the Query Loop feature in Bricks to display a responsive grid of posts using CSS…Read more →Categories: Bricks, ProTags: Query Loop
Random Posts in the Same Category as the Current Single CPT Post in BricksHere’s how query loop can be set in Bricks to show related posts by a taxonomy’s termsRead more →Categories: Bricks, FreeTags: Query Loop
Pro Post-specific ACF Repeater Galleries as Sliders in BricksHow to output ACF Repeater field rows with the images of the Gallery-type sub field as a slider.Read more →Categories: Bricks, Plugins, ProTags: ACF Pro, Nested Queries
Adding any Custom WP_Query loop to Bricks’ Query LoopSometimes we may need to create a custom post loop using Bricks' query loop feature, but wish to use our own WP_Query code for more…Read more →Categories: Bricks, FreeTags: bricks/query/run, Query Loop, WP_Query
Pro Child Posts Section in BricksThis Pro tutorial provides the steps to limit the posts (can be of any post type) output by Bricks' query loop to children of the…Read more →Categories: Bricks, ProTags: Query Loop
Pro ACPT Gallery Field Query Loop in BricksHow we can output images from ACPT‘s Gallery field for posts as a grid using a query loop.Read more →Categories: Bricks, Plugins, ProTags: ACPT, Query Loop