For using Archive Types, the main building block is query. The query works just like the normal WordPress queries, the details about which can be found at WordPress Codex.
In this plugin, there are two ways of specifying queries for archive types
- At creation, In the specification of Archive Types
- At Runtime, using attribute “query” in the shortcode.
At creation, In the specification of Archive Types
For specifying the query at the time of creation gives you an option to specify the default output of the archive. In This for instance you can use query
which would output posts in uncategorized category.
But it doesn’t specify the number of posts you want to specify in that archive. Lets say you want to add another condition in the query for limiting the number of posts to 3. So the query becomes
So for concatenating the variable & is used.
Details for creating more custom queries is given on WordPress Codex at http://codex.wordpress.org/Function_Reference/query_posts
At Runtime, using attribute “query” in the shortcode.
You can also change the query on runtime, this can be done by adding attribute query to default short-code used for accessing the archive.
For example, lets say there is an archive named venus having default query
hence displays 5 posts from post type News.
Now if you want to use the same archive at a different place but for post type photos, then all you need to do is add the attribute query=”post_type=photos” in the shortcode call.
Hence the final shortcode becomes:
Currently attributes involving use of arrays are not directly supported, Though you could hack into using arrays in query string like this
Original query (From Codex) gives post from category 1 and 3 with two post per page:
category__and => array(1,3), 'posts_per_page' => 2