Looping through a collection

Shortcode: aw2_loop

Loop through results of aw2_query_posts, aw2_query_terms, aw2_query_users . In case you need a loop within a loop use aw2_set_template


It is equivalent to


foreach (array_expression as $key => $value)

Parameters

——————–


id: The Collection to Loop. Defaults to ‘default_collection’

Example

—————-

Working with One Item inside a Loop

Shortcode: aw2_loop_item

To access the current item being looped

Parameters

——————–


main: the field to return. can be the following.


loop_index to get the index value.


loop_key to get the key if the current value is a key:value pair


loop_value to get the value if the current value is a key:value pair
main: The condition to check. Possible values odd,even,first,last,between. Will execute what is inside based on the condition. 

set_param: defaults to empty. the variable to store the return value in. If empty then will throw out the value

Examples

——————

Getting Value from an item within a loop

Shortcode: aw2_loop_value

Accessing the Value of an Item within a loop

Parameters

——————–


main: The Key for which the Value has to be returned


id: defaults to default_item . All Queries like [aw2_query_post post_id=’1′] , [aw2_query_user] returning one object/array default to the same


cond: any If conditions. If a condition is passed then only runs if the condition is met


default: The default value to return if the key is not found


meta=single,array: Set meta as single if you want to access meta data as single. Set meta as array if you want to get back an array


set_param='': defaults to empty. the variable to store the return value in. If empty then will throw out the value


taxonomy: To get a taxomony for a post. See Example for complete syntax. The return value must be from http://codex.wordpress.org/Function_Reference/wp_get_post_terms

Examples of different scenarios

—————————————–

Examples