Overview
Using the Pods shortcode is oftentimes the best way to get content exactly where you want it. You can also use the shortcode to prototype output before transferring it into Pods Templates or Widgets for output. If you’re lost on figuring out the where
parameter below, we can highly recommend the find
code reference and the Find PodsCast.
Quick Start
[pods name="pods-name" template="template name"]{@post_title}[/pods]
Note: When using this shortcode within Pods templates you cannot use it as a nested shortcode since the magic tags will be parsed before parsing the shortcode. You will need to use the `template` parameter.
Available Parameter Options
Examples
List
List all items whose value for a specific field matches a string. The example assumes you’re working with a Custom Post Type and my_field is a custom field within that post type.
[pods name="pod" limit="3" where="my_field.meta_value = 'Great'"]{@post_title} is great![/pods]
Single
Show a single item determined by post ID or post slug.
[pods name="pod" id="5"]{@my_field} is great![/pods] [pods name="pod" slug="my-item"]{@my_field} is great![/pods]
Display a field from a single Pod item
[pods id="1" field="post_title"] [pods slug="the-post-slug" field="post_title"] [pods slug="the-post-slug"]{@post_title}[/pods] [pods name="pod" id="5" field="my_field"] [pods name="pod" slug="my-item" field="my_field"]
Display a field from the current post
[pods field="my_custom_field"] [pods]{@my_custom_field}[/pods]
Form with all fields
Output a form with all fields in a Pod.
[pods_form name="pod"] [pods name="pod" form="1"]
Form With Specific Fields
Output a form with only the specified fields.
[pods_form name="pod" fields="my_field,another_field"] [pods name="pod" form="1" fields="my_field,another_field"]
Include a file from a theme, with caching options
[pods view="includes/awesome-list.php" cache_mode="cache" expires="3600"]
Use a template to display fields.
By specifying a Pods Template in the “template” argument you can display one or more items with that template.
The first example displays a specific post item (id=5); the second example shows a list of 5 items.
[pods name="pod_name" template="template_name" id="5"] [pods name="pod_name" template="template_name" limit="5"]
Show a Pods Page
You can display one or more items in a Pod, using Pods pages, via a shortcode.
[pods name="pod_name" page="page_name" id="5"] [pods name="pod_name" page="page_name" limit="5"]
Yes No Field matching all Yes’s
[pods name="podsname" where="yesno_field.meta_value = 1"]{@post_title}[/pods]
Get Pods by taxonomy term slug(s)
[pods name="podsname" where="taxonomy_name.slug = 'term slug'"]{@post_title}[/pods]
[pods name="podsname" where="taxonomy_name.slug IN ('term slug 1', 'term slug 2', 'term slug 3')"]{@post_title}[/pods]