Categoría: BRICKS PRO QUERY LOOP
-
Excluding Duplicate Posts from Query Loops in Bricks
Updated on 16 Oct 2024 This Pro tutorial provides the steps to ensure that posts are not duplicated when two or more query loops are used on the same page in Bricks. Let’s take a sample scenario where we have 2 query loops. The first query loop shows 6 random testimonials. The second query loop…
-
Parent post Bricks query loop
Updated on 5 Feb 2024 In the BricksLabs Facebook group a user asks: Is there a way to output the data of a parent post in a child post? Are there tutorials for this? This Pro tutorial provides the steps to output the current single post’s parent post using a Bricks query loop for hierarchical…
-

6 Random Featured Posts in Alphabetical Order in Bricks
In the BricksLabs Facebook group a user asks: I am looking for a solution where I can randomly choose a given number of posts (e.g., 6) with a specific meta value (e.g., featured) and then order by the title (ascending). This Pro tutorial provides the steps to use the PHP query editor of Bricks to…
-
Ordering Posts by Terms in Bricks
In the Bricks Facebook group a user asks: Hello everyone. I have a CPT ‘events’ and a taxonomy ‘event-did-it-happen’ in which there are two items ‘past’ and ‘upcoming’. I need to list all the ‘events’ posts sorted by ‘event-did-it-happen’ in a loop so that they are ‘upcomming’ first and then ‘past’. I have created a…
-

6 Random Posts from Tag A + 6 Random Posts from Tag B in a Single Bricks Query Loop
A user asks: Hello! In a query loop, I need to output 12 random posts. 6 with the 1001 tag and 6 with the 1002 tag. Any suggestions on how to achieve that before I fire up VS code? This Pro tutorial shows how this can be done in a Bricks query loop. Step 1…
-
Query Loop in Bricks
This Pro tutorial walks you through the steps to use the Query Loop feature in Bricks to display a responsive grid of posts using CSS Grid while reducing the load on the database using a Bricks filter hook. For each post we are going to set up: featured image in a custom image size linking…
-
Nested Queries in Bricks – Posts Grouped by Published Years and Categories
In the past we showed how posts could be grouped by years in Bricks. This Pro tutorial takes it further by grouping posts by categories which are further grouped by years. The year headings will be dynamic – in the sense they will only be the ones in which there is at least 1 published…
-
Child Posts Section in Bricks
This Pro tutorial provides the steps to limit the posts (can be of any post type) output by Bricks‘ query loop to children of the current single post being viewed on the front end. Note: The post type should be set to be hierarchical with Page Attributes support. We shall also ensure that the Section…
-
Current Single Post Reference From Inside a Bricks Query Loop
Updated on 16 May 2024 When working on advanced customizations in Bricks, sometimes it is necessary to get a handle of the current single post (of any post type) in which a query loop is present from inside the query loop. Sample use case: Get the single post’s custom field (like ACF Repeater or Meta…
-
Alternating Posts from Two Post Types in Bricks
This Pro tutorial provides the steps to output posts from two post types (could be the built-in ones or CPTs) in an alternating manner in a Bricks query loop. Step 1 In the Bricks editor, enable query loop on a Block. Click the query icon and enable PHP query editor. Paste: // Get posts from…