=== WPQuery Shortcode ===
Contributors: indyarmy
Link: http://indyarmy.com/wpquery-shortcode/
Tags: query, wpquery, shortcode, wp_query, loop
Requires at least: 3.5
Tested up to: 3.8
Stable tag: 1.1.2
License: MIT
License URI: http://opensource.org/licenses/MIT
A lightweight plugin that wraps the functionality of WP_Query in an easy-to-use shortcode.
== Description ==
**WPQuery Shortcode** is a lightweight plugin that wraps the functionality of WP_Query in an easy-to-use shortcode.
Several filters are built in to allow all kinds of messing with how the output is displayed. From a simple "Recent Posts" block on your page to displaying upcoming events from your calendar plugin to showing the most visited job postings, **WPQuery Shortcode** makes it easy.
### Examples ###
The most basic example is this:
[wqs][/wqs]
Which returns the following HTML by default:
`
#### `wqs_header` ####
* executed immediately after the `wqs_wrapper_start` filter
* intended to allow theme authors to mess with the passed shortcode content (which is, itself, intended to be the header for the resulting list)
* passed three parameters:
* `$header` - the content between the `[wqs]` and `[/wqs]` tags
* `$class` - the CSS class from the shortcode
* `$post_type` - the post type from the shortcode (eg. `post`, `attachment`, `movie`)
* **Return** a header to display above the resulting list
* **Default** `
$header
` or `NULL` if `$header` is empty
#### `wqs_pre_results` ####
* executed before The Loop begins, but after we have confirmed there is at least one result to display
* intended to allow theme authors to customize the wrapper for the result list itself
* passed two parameters:
* `$class` - the CSS class from the shortcode
* `$post_type` - the post type from the shortcode (eg. `post`, `attachment`, `movie`)
* **Return** an opening wrapper element for the list of results
* **Default** `
`
#### `wqs_pre_item` ####
* executed before each item in the result list
* intended to allow theme authors to customize the element that wraps each item in the list
* passed two parameters:
* `$class` - the CSS class from the shortcode
* `$post_type` - the actual post type (eg. `post`, `attachment`, `movie`)
* **Return** an opening wrapper element for the current item
* **Default** `- `
#### `wqs_item_link` ####
* executed within the Loop
* passed four parameters
* `$permalink` - the WordPress generated permalink URL to the item
* `$title` - the title of the soon-to-be-displayed item (be it post, page, comment, or whatever)
* `$class` - the CSS class from the shortcode
* `$post_type` - the actual post type (eg. `post`, `attachment`, `movie`)
* **Return** a link to the post
* **Default** `{$title}`
#### `wqs_show_thumb` ####
* executed within the Loop
* passed four parameters:
* `$thumb` - an empty string
* `$post_id` - the ID of the current post (same as `get_the_ID()` function)
* `$class` - the CSS class from the shortcode
* `$post_type` - the actual post type (eg. `post`, `attachment`, `movie`)
* **Return** ideally, the thumbnail
* **Default** `
` or `$thumb` if the call to `has_post_thumbnail($post_id)` fails
#### `wqs_show_excerpt` ####
* executed within the Loop
* passed four parameters:
* `$excerpt` - a string containing the result of a call to `get_the_excerpt()`; should be modified and `return`ed
* `$post_id` - the ID of the current post (same as `get_the_ID()` function)
* `$class` - the CSS class from the shortcode
* `$post_type` - the actual post type (eg. `post`, `attachment`, `movie`)
* **Return** an excerpt for the current post
* **Default** `$excerpt`
#### `wqs_show_date` ####
* executed within the Loop
* passed four parameters:
* `$date` - a string containing the result of a call to `get_the_date()`; should be modified and `return`ed
* `$post_id` - the ID of the current post (same as `get_the_ID()` function)
* `$class` - the CSS class from the shortcode
* `$post_type` - the actual post type (eg. `post`, `attachment`, `movie`)
* **Return** a date string to display
* **Default** `$date`
#### `wqs_post_item` ####
* executed after each item in the result list
* intended to allow theme authors to customize the element that wraps each item in the list
* passed two parameters:
* `$class` - the CSS class from the shortcode
* `$post_type` - the actual post type (eg. `post`, `attachment`, `movie`)
* **Return** a closing wrapper element for the current item
* **Default** ` `
#### `wqs_post_results` ####
* executed after The Loop finishes, but only if at least one result existed
* intended to allow theme authors to customize the wrapper for the result list itself
* passed two parameters:
* `$class` - the CSS class from the shortcode
* `$post_type` - the post type from the shortcode (eg. `post`, `attachment`, `movie`)
* **Return** a closing wrapper element for the list of results
* **Default** `
`
#### `wqs_wrapper_end` ####
* executed immediately befoer the call to `wp_reset_postdata()`
* intended to allow theme authors to customize the wrapper element(s)
* passed two parameters:
* `$class` - the CSS class from the shortcode
* `$post_type` - the post type from the shortcode (eg. `post`, `attachment`, `movie`)
* **Return** the closing wrapper element(s)
* **Default** `
`
#### `wqs_result_empty` ####
* executed after the `wqs_header` filter if there are no results
* passed three parameters:
* `$message` - the `show_empty_message` value from the shortcode
* `$class` - the CSS class from the shortcode
* `$post_type` - the post type from the shortcode (eg. `post`, `attachment`, `movie`)
* **Return** the message to display if no posts are found
* **Default** `