=== Custom Content Shortcode ===
Tags: custom post type, custom field, shortcode, query, loop
Requires at least: 3.0.1
Tested up to: 3.6
Stable tag: 0.1.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Add a shortcode to get content or field from any post type
== Description ==
This plugin adds a shortcode to get the content or a field from any post type.
There is also a shortcode to perform query loops, with which you can create layouts for displaying the content and fields of a specific post type, category, etc.
= Basic examples =
*Display post content by name*
[content type="post" name="hello-world"]
*Display the featured image of a page*
[content type="page" name="about-me" field="image"]
*Display a custom field from a custom post type*
[content type="apartment" name="lux-suite-22" field="rent-per-day"]
*Display fields from the current post*
The Article [content field="title"] by [content field="author"] was written on [content field="date"].
= Available parameters =
Here are the available parameters for the *content* shortcode.
* **type** - which post type to target (post / page / custom post type) - if empty, the default is "page"
* **name** or **id** - which entry to target by its ID or name (slug not post title) - if empty, the default is the current post
* **field** - which field to get - if empty, default is the main content of the post
You can display custom fields you created, as well as predefined fields: *title*, *id*, *author, date*, *url*, *image*, *image-url*, *thumbnail*, and *excerpt*.
= Query loops =
There is also a shortcode to perform query loops.
*Display all posts*
[loop type="post"]
[content]
[/loop]
Notice that inside a query loop, the *content* shortcode does not need *type* and *name* parameters, because it is targeting the current post in the loop.
*Display fields from all posts of a custom post type, filtered by category*
[loop type="apartment" category="suite"]
Apartment: [content field="title"]
Rent per day: [content field="rent-per-day"]
[/loop]
Available parameters for the *loop* shortcode are:
* **type** - which post type to query (post / page / custom post type) - if empty, the default is "page"
* **category** - display posts from a category
* **count** - number of posts to show
* **tag** - display posts with a specific tag (for multiple tags: *tags="apples, green"*)
In addition, you can use parameters of the [WP_Query class](http://codex.wordpress.org/Class_Reference/WP_Query), such as *author_name* and *order*. Custom field and taxonomy parameters are not yet supported.
= Custom content layout =
Here is an example of how the *loop* and *content* shortcodes can be used to create layout templates.
1. Let's imagine a bicycle shop. We create a custom post type called *bicycle*, and add custom fields such as *model*, *price*, and *description*.
1. Add all bicycles as new entries, with featured image and other info in the fields.
1. Create a new page to display the bicycles. A basic layout could be:
[loop type="bicycle"]
[content field="image"]
Model: [content field="model"]
Price: [content field="price"]
Description: [content field="description"]
[/loop]
1. Another page could display a list of bicycles of the *freestyle* category:
Freestyle bikes available: