aw2_loop

This shortcode is used to loop through results of aw2_query_posts, aw2_query_terms, aw2_query_users or any collection, array or object. aw2_loop can be considered as equivalent to foreach(array_expression as $key => $value)

attributes:

  • id:
    ID of the collection that you want to loop. If it is not specifed it defaults to ‘default_collection’
An array object saved as param can also be used as ID to loop thorough it.

p.s remove the space between “[” and “aw2” in the examples below, they have been added to avoid their execution on this page.

Examples:

Basic usage of aw2_loop

saving parameter and then looping through it

Example of aw2_loop with ID