aw2_collection

In our Awesome Development platform, objects and arrays are termed as collections. aw2_collection allows you to access various properties of that object and/or array. If you have WP_Query result object then you can access most of it’s properties directly using aw2_collection.

attributes:

  • main:
    count | stringify | yes | no | total_posts | is_last_page | next_page | previous_page | previous_records | more_records | previous_offset | next_offset | current_page

    yes/no is used to check if we have any records in the collection, and execute the shortcode within aw2_collection based on it. If collection is type of WP_Query class then you can use total_posts, is_last_page, next_page, previous_page, previous_records, more_records, previous_offset, next_offset, current_page to get these values. stringify allows you to convert array collection to string.
  • id:
    ID of the collection which you need to access. If it is not specified it defaults to ‘default_collection’
aw2_collection allows you to access query_vars as well as any property of any collection object directly.

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

Examples:

Most often we use aw2_collection, to do following

If collection is WP_Query object then