> For the complete documentation index, see [llms.txt](https://docs.wpcodelabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wpcodelabs.com/plugins/wp-query-engine/shortcode.md).

# Shortcode

## Standard Parameters

The shortcode accepts several parameters:

* **post\_type** : Comma separated list of post types to query
* **posts\_per\_page** : Integer value of the posts to query
* **category\_\_in** : Comma separated list of categories to include
* **category\_not\_in** : Comma separated list of categories to exclude
* **tag\_\_in** : Comma separated list of tags to include
* **tag\_\_not\_in** : Comma separated list of tags to exclude
* **author\_\_in** : Comma separated list of authors to include
* **author\_\_not\_in**: Comma separated list of authors to exclude
* **template** : String template name or path to template relative to the theme directory (optional)
* **pagination** : True/false whether to use pagination (default: false)
* **ignore\_sticky\_posts** : Whether to ignore sticky posts (default: false)
* **orderby** : What to order the posts by
* **order** : ASC or DESC sort order
* **context** : String context used to filter the query during execution, optional

### post\_type

A comma separated list of post types to query.

* Default: post
* Required: false
* Type: comma separated list

```php
[wp_query post_type="post, page, event"]
```

### posts\_per\_page

Number of post to show per page. Use **-1** to show all posts. If combined with the pagination parameter, it will limit the posts per page. If pagination is false, it will limit the total number of posts displayed.

* Default: wordpress default
* Required: false
* Type: integer

### category\_\_in

Display posts that have these categories.

* Default: null
* Required: false
* Type: comma seperated list of category names, slugs, or id's

### category\_not\_in

Exclude posts that have these categories.

* Default: null
* Required: false
* Type: comma seperated list of category names, slugs, or id's

### tag\_\_in

Display posts that have these tags.

* Default: null
* Required: false
* Type: comma seperated list of tag names, slugs, or id's

### tag\_\_not\_in

Exclude posts that have these tags.

* Default: null
* Required: false
* Type: comma seperated list of tag names, slugs, or id's

### author\_\_in

Display posts by these authors.

* Default: null
* Required: false
* Type: comma seperated list of author names, or id's

### author\_\_not\_in

Exclude posts by these authors. Accepts name, or id's. Passed as a comma seperated list.

* Default: null
* Required: false
* Type: comma seperated list of author names, or id's

### template

Specify the output template. This can be done in one of several ways:

1. **By Name:** If you've registered your template with the plugin, you can specify the template by name
2. **By path:** If you have not registered your template, you can specify the path relative to your themes root directory. If a path is specified, the plugin will attempt to load the template if possible.

* **Default:** Plugin Default
* **Required:** false
* **Type:** string

**Note:** The plugin contains a default template that will be used if no template is specified.

```php
[wp_query template="my_custom_template"]

[wp_query template="my_custom_template.php"]

[wp_query template="my_template_path/my_custom_template.php"]

[wp_query template="my_template_path/my_custom_template"]
```

### pagination

Whether or not to paginate the posts displayed

* Default: false
* Required: false
* Type: boolean ( true / false )

### ignore\_sticky\_posts

Ignore default sticky post functionality. If set to true, sticky posts will appear in the normal post order. If false, sticky posts will appear first.

* Default: true
* Required: no
* Type: boolean ( true / false )

### orderby

What data to order the posts by

* Default: date
* Required: no
* Type: String, see the [codex](https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters) for all options

### order

How to order posts

* Default: DESC
* Required: no
* Type: ASC / DESC

### context

Optional string used to identify a specific instance, for additional actions and filters.

* **Default**: null
* **Required**: false
* **Type**: string

## Dynamic Parameters

The shortcode can also perform custom taxonomy queries using any taxonomy name, in the format:

### {tax\_name}\_\_in

Display posts that contain this taxonomy terms.

* Default: null
* Required: false
* Type: comma seperated list of term names, slugs, or id's

### {tax\_name}\_\_not\_in

Exclude posts that contain this taxonomy terms.

* Default: null
* Required: false
* Type: comma seperated list of term names, slugs, or id's

**Examples**

To query all posts of post type "recipe" with the taxonomy of "recipe\_type" with the terms "breakfast" or "brunch", and using the "List" template:

```php
[wp_query post_type="recipe" recipe_type__in="breakfast, brunch" template="List"]
```
