All Collections
Dynamic Shortcodes
Dynamic Shortcodes Types
How to Loop Posts with Dynamic Shortcodes
How to Loop Posts with Dynamic Shortcodes
Updated over a week ago

With the Loop Dynamic Shortcode (DS) you can comfortably loop over posts by setting the current post at each iteration. Freeing you from the need to reference the post ID when displaying its data.

If you want to loop over something other than WordPress posts use the for instead.


It takes two arguments:

  • An array of posts IDs to loop over. Usually these are provided by another DS like the Query one or also manually with an array DS.

  • Another value to be printed at each iteration. Usually a template, but can also be a single a DS (like the Elementor Template one).

It takes one optional keyarg:

  • separator (alias sep): Defines a string to separate each iteration's output. Default is an empty string.


Display the titles of the posts with ID 1, 2 and 3, separated by a comma.

{loop: {array: 1 2 3} {post:title} @ sep=','}

Display a list of links to posts in the technology category.

{query:posts @ category-name=technology}
[<li><a href="{post:permalink}">{post:title}</a></li>]}
Did this answer your question?