Hi nkholski,
Sorry for any confusion. Shortcode args are not extremely well documented.
For reference, here is how query short code args work:
First, there is one big rule that cannot be avoided in the current version of Query Wrangler, and that is:
The args= property can only the same accept parameters as the WP_Query( 'args' ) class accepts as a string.
https://codex.ww.wp.xz.cn/Class_Reference/WP_Query
That means all complex queries that require arrays are out.
The second rule is that it can only accept parameters available to the WP_Query class.
In your case, there is no query parameter for the post_title, so you’ll need to use something else.
For getting a single page or post, I recommend the name (post slug) or pagename (page slug) parameters.
[query slug="test-args" args="name=zerimar"] will get a post with the slug of “zerimar”.
In your first case, that could look like this:
[query slug="contacts" args="name=anna"]
Unfortunately for your second case, the name and pagename parameters do not accept multiple values, so you need to probably use a shared post_tag,
[query slug="contacts" args="tag=friends"]
or category.
[query slug="contacts" args="category_name=friends"]
For queries on multiple targets, figure out how they relate to each other (taxonomy term, meta value, etc ), create that relationship, and then use that relationship in your query arguments.
Meta Value Example:
1. Assume both Anna and Dana have a meta field with the key of “is_smart” and the value of “yes”:
[query slug="contacts" args="meta_key=is_smart&meta_value=yes"]
2. Assume you want to show only contacts that have a Featured Image, and you want to sort them by their post_titles.
[query slug="contacts" args="meta_key=_thumbnail_id&orderby=title"]
Contextual tokens examples:
Assume I want to create a “related posts” query that will show a list of posts related to the current one being viewed. For this to happen, I need to get the context of the current post, and its post_title. Then, I’m going to pass that value into the query as a search parameter.
[query slug="related-posts" args="s={{post:post_title}}"]
Let’s walk through it.
1. I created a query in Query Wrangler called “Related Posts”
2. I created a post titled “Tom Hanks” and placed the above shortcode into the new post.
3. When viewing the page, the shortcode with convert {{post:post_title}} into the value of the post_title property of the current post $post->post_title.
4. Using the WP_Query search parameter “s”, the query will return posts that mention “Tom Hanks”.
This example is a bit contrived, but hopefully it provides some insight.
One more contextual token example:
Assume you have a pages in a hierarchy and you want for parent pages to always show a list of their children pages.
[query slug="child-pages" args="post_parent={{post:ID}}"]
For contextual queries that appear on many pages, you may consider placing a Query Wrangler Widget in a sidebar. They can also accept these argument strings.
Hope this helps,
Jonathan