Shortcode
embed pod items into WP posts or pages
Shortcode allows you to place Pod items directly into WP Posts, WP Pages, and Pod Pages.
Usage
// List 10 events [pods name="event" order="t.id DESC" limit="10" template="event_list"]
// Show detail template for event [pods name="event" slug="wordcamp-nyc-2010" template="my_event_detail"]
Available Tags
| Attribute | Details |
|---|---|
| name | (required) the pod name |
| id | (optional) the pod item's ID, if retrieving a specific item |
| slug | (optional) the pod item's slug, if retrieving a specific item |
| order | (optional) This is the equivalent of ORDER BY in MySQL. It is overridden when id or slug are defined. Default: "t.id DESC" |
| limit | (optional) The maximum number of items to return. Default: 15 |
| where | (optional) This is the equivalent of WHERE in MySQL. It is overridden when id or slug are defined. |
| col | (optional) The name of the column to return from a specific Pod Item. id or slug MUST be defined for this option to work. |
| template | (optional) The name of the template to use. "col" must NOT be defined for this option to work. |
| helper | (optional) If using col, an optional Display Helper to pass the value through |
Examples
// Minimum Attributes Necessary to List items
[pods name="event" template="event_list"]
// Minimum Attributes Necessary to Show a Detail of an item (using templates)
[pods name="event" id="4" template="event_detail"]
[pods name="event" slug="my-event-slug-here" template="event_detail"]
// Minimum Attributes Necessary to Show a Column of an item
[pods name="event" id="4" col="event_description"]
[pods name="event" slug="my-event-slug-here" col="event_description"]
// Show a Column of an item (using helpers)
[pods name="event" id="4" col="event_photos" helper="photo_gallery"]
[pods name="event" slug="my-event-slug-here" col="event_photos" helper="photo_gallery"]
// List 10 events ordered by ID descending
[pods name="event" order="t.id DESC" limit="10" template="event_list"]
// List 10 events ordered by ID ascending
[pods name="event" order="t.id" limit="10" template="event_list"]
// List 10 events ordered by name ascending then by ID descending
[pods name="event" order="t.name ASC,t.id DESC" limit="10" template="event_list"]
// List 10 events ordered by the name of the 'pickname' related pod item
[pods name="event" order="pickname.name DESC" limit="10" template="event_list"]
// Show detail template for event (using id)
[pods name="event" id="2" template="event_detail"]
// Show detail template for event (using slug)
[pods name="event" slug="my-event-slug" template="event_detail"]
// Use PHP to output a shortcode for showing detail template for event (using slug)
<?php
echo do_shortcode('[pods name="event" slug="my-event-slug" template="event_detail"]');
?>
// Use PHP to output a shortcode for listing 25 events
<?php
echo do_shortcode('[pods name="event" template="event_list" limit="25"]');
?>