5th Oct '22
/
0 comments

Dynamic Post ID in Query Loop

Updated on 6 Oct 2022

Looking for a unique ID for each post’s row in the output of Bricks’ Query Loop?

Here’s how: Add an id attribute for the element on which query loop is enabled with the value being:

post-{post_id}

One of the use cases is that this enables you to link to these posts from the Nav Menu.

Update: If you want to have incremental post IDs, you could use dynamic tag added by BricksExtras like this:

post-

Reference: https://bricksextras.com/docs/dynamic-tags/

Get access to all 630 Bricks code tutorials with BricksLabs Pro

Leave the first comment

 

Related Tutorials..

Pro
Host Post’s Term in Bricks Query Loop

Host Post’s Term in Bricks Query Loop

Updated on 4 Mar 2025 In the BricksLabs Facebook group a user asked: Hi everyone, I’m facing a tricky situation that might have a simple…
Categories:
Pro
Top-level Pages and Children Bricks Query Loop

Top-level Pages and Children Bricks Query Loop

This Pro tutorial for Bricks users can be considered Part 2 or a variation of the earlier Bricks Query Loop for Top-level Parent Pages with…
Categories:
Pro
Query Loop Index in Bricks

Query Loop Index in Bricks

This Pro tutorial provides the code for getting the index of each post in Bricks' query loops. This can be used for either outputting the…
Categories:
Pro
Custom SQL Ordering for Sorting Events in Bricks

Custom SQL Ordering for Sorting Events in Bricks

Showing events ordered by the event date with upcoming events in ascending order and past events in descending order.
Categories:
Bricks Templates Query Loop

Bricks Templates Query Loop

How display Bricks Templates with saved screenshots in a query loop.
Categories:
Pro
Events grouped by months within years based on event date custom field value

Events grouped by months within years based on event date custom field value

How to output events grouped by years and months using three nested query loops in Bricks.
Categories: