This shortcode is used to access the value of current item being looped withing aw2_loop. aw2_loop_value lets you access the value directly by specifying the key within a collection.
If specify any of the aw2_if conditions parameters, then item will only be returned if that condition is met.
- set_param :
If it is specified, then the value to be returned will be saved to the specified parameter, and it will return nothing.
Default value to return if key is not found.
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 it to true to access the details of author of the post. You can specify ‘login’, ‘pass’, ‘nicename’, ’email’, ‘url’, ‘registered’, ‘activation_key’, ‘status’ as key to get these values.
To get a taxonomy terms of a post. See example for complete syntax. The return value must be from wp_get_post_terms
The key for which the value has to be returned
aw2_loop_value also supports various common formatting attributes of Awesome Studio Framework. You can specify following values to the main attribute above if you are looping through a post object
It returns permalink of the post item.
It gives the featured image of the post item, it return the full img tag. By giving ‘size‘(full | thumbnail | medium) attribute along with it, you can get image of specific size.
It just gives the absolute url of the featured image. You can specify ‘size‘ attribute to get specific size image
If a image url of third party site is specified to ‘external_image_url‘ it downloads that image and attached it to post meta for future use, and return the local image url of the ‘size’ specified.
returns the excerpt of the post. you can use ‘length‘ to control number of words to return, it defaults to 20.
This gives the content of the post, after applying the filter the_content and executing all the shortcodes inside the post. If you want to just get the content without firing executing the shortcodes use post_content.
WordPress Post Object
All the properties of a WordPress post object that is shown below can be accessed directly by using the key.
Examples of using aw2_loop_value:
We are assuming following query results for the example
Getting meta data of a post or user object.
Meta Data as Array of a Post
Getting taxonomy associated with a Post, for all the list fields that you can use see, wp_get_post_terms
Author Associate with the post
Get the permalink of the post
Get the Featured Image of the post
Get the Excerpt of the post. For direct excerpt use post_excerpt.
Get the post content with filters applied and also executed for shortcode