Accessing Current Post ID within Loop

I am trying to add a code block within a Query Loop Template and want to access the ID of the current post in the loop iteration. How can this be accessed? It does not appear that you can use get_the_id() or global $post to access the post object within the loop. Is there another method to access it?

Did you found how to do.
That is my problem today and can’t find the solution.

I’m sorry I missed this @bmc38119.

@weedor, working fine on my end:

Thank you @Louis
I made a wrong request!
In fact I am looking for the ID OF the loop in order to dynamically design some blocks via this ID.
If I can’t the design affects every blocks in the loop.
Exemple: id=“div-c38f4f8-q-2” → I want to extract 2
If it is possible, it would be great that the very first item ID in the loop was nammed with the same mask instead of only id=“div-c38f4f8”. id=“div-c38f4f8-q-1” would be appreciate.

@Louis

Thanks for the reply. I did get this figured out shortly after posting my question. However, I am wondering if there are any plans to display the output of the code in all items in the loop (in the editor). Right now - in the editor - the output displays for the first item in a loop only - and the rest of the items show “Code Block.” This would help the editing experience by showing actual content.

Hello @weedor,

This is an interesting point, and valid in many ways.
You can currently access the loop ID by using the dynamic tag {loop-id} when using a Cwicly block.

@bmc38119, we did initially allow the Code block to be rendered in every queried item, but it did end up causing more trouble than anything else as Code blocks do have to make specific calls to the server to return their current state. Might be something we can add as an option if you find this would improve usability!

Is there anyway to access the {loop-id} dynamic tag programmatically?

I need to construct a URL for every item in the loop using the index/ID of the post. Example:

/some-url/item/1
/some-url/item/2
/some-url/item/3
...