aw2_query_post

This shortcode is used to get the value of single post based either post ID or post slug. aw2_query_post can return a single value or a post object. Values from post object can be accessed using aw2_value.

attributes:

  • slug:
    It is slug of the post whose data you want to fetch.
  • post_id:
    If you have ID then you can get the post data using post ID.
  • post_type:
    If you use post slug, then you need to specify post_type for fetching the post data.
  • id:
    ID is used to specify unique identifier to the returned results, if not specified it defaults to default_item.
  • main:
    You can use main attribute to return single value from post data instead of post object
  • set_param:
    If using main you can save single value as param by specifying set_param.

You can use conditionals from aw2_if to control the execution of aw2_query_post.

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

Examples:

Getting post data using slug

Getting post data using post_id

getting single value of post object