Pods Shortcode

Using our Shortcode to get content on your website is often the easiest method since you can drop these into a page, HTML block or HTML Widget.

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

OPTION TYPE DEFAULT DETAILS
name (string) null The name of the Pod that will supply the data.
id (int) null The ID of the target post or Pod item.
slug (string) null The slug of the target post or Pod item.
select (string) null The ‘select’ parameter to pass to find()
order (string) null (deprecated) This tag remains for 1.x shortcode compatibility; use ‘orderby’ instead.
orderby (string) null The ‘orderby’ parameter to pass to find()
limit (int) null The ‘limit’ parameter to pass to find()
offset (int) null The ‘offset’ parameter to pass to find()
where (string) null The ‘where’ parameter to pass to find()
having (string) null The ‘having’ parameter to pass to find()
groupby (string) null The ‘groupby’ parameter to pass to find()
page (int) null The ‘page’ parameter to pass to find()
pagination (bool) false The ‘pagination’ parameter to pass to find()
pagination_type (string) `advanced` The ‘pagination_type’ to display, see Displaying Pagination
pagination_label (string) ‘Go to page’ The label to use for the pagination text
pagination_location (string) ‘after’ Where to show the pagination before/after the list
search (bool) true The ‘search’ parameter to pass to find()
filters (bool) false A comma separated list of field names (relationship only fields) to be passed as the ‘fields’ parameter to filters().
filters_label (string) ‘Search’ The label to use for the search text
filters_location (string) ‘before’ Where to show the filters before/after the list
field (string) null The field name to display. To display multiple fields, use the opening and closing shortcode syntax with magic tags.
col (string) null (deprecated) This tag remains for 1.x shortcode compatibility; use ‘field’ instead.
template (string) null The name of the Pods template to be used.
pods_page (string) null Output Pods Page content (if using the Pods Pages component) using the Pods Page path.
helper (string) null The function (supported) or Pods Helper (deprecated) to use on the field value before output.
view (string) null The file path relative to the theme to include.
form (string) null Set this to a non-empty value to display a Pods form.
fields (string) null A comma separated list of field names to be passed to form(). Only used in conjunction with the ‘form’ tag.
label (string) null Save button label for the Pods form. Only used in conjunction with the ‘form’ tag.
thank_you (string) null Thank you URL to send to upon success. Only used in conjunction with the ‘form’ tag.
form_output_type (string) ‘div’ The output type to use when rendering form fields. Available options: div, p, ul, table. Only used in conjunction with the ‘form’ tag.
blog_id (int) null The blog ID to let you query data on another blog on multisite (must be enabled through the new PODS_SHORTCODE_ALLOW_BLOG_SWITCHING constant).
cache_mode (string) ‘none’ Specify the caching method to use for the pods_view(), available options include ‘cache’, ‘transient’, ‘site-transient’, and ‘none’. Only used in conjunction with the ‘view’ tag.
expires (int) 0 Time in seconds for the cache to expire; set to 0 to disable caching. Only used in conjunction with the ‘view’ tag.
use_current (int) 1 Force the shortcode to use the current object in the query on the page it’s listed on. Usage use_current="1"
not_found (string) null Text to output when the shortcode doesn’t find any results, supports html and magic tags.

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

You can query against custom fields using the where clause.
[pods name="podsname" where="yesno_field.meta_value = 1"]{@post_title}[/pods]

Get Pods by taxonomy term slug(s)

You can query against terms using the where clause.
[pods name="podsname" where="taxonomy_name.slug = 'term slug'"]{@post_title}[/pods]
Or query against multiple terms.
[pods name="podsname" where="taxonomy_name.slug IN ('term slug 1', 'term slug 2', 'term slug 3')"]{@post_title}[/pods]

Other Helpful Documentation on Displaying Pods

Access Rights in Pods

An overview of how Access Rights works in Pods

Displaying Custom Taxonomy Term Meta

To display the custom fields you’ve extended to your Custom Taxonomy, you’ll need to use the function get_term_meta. /* $term_id is the Taxonomy Term 'field_name' is the Custom Taxonomy term */ $field_value = get_term_meta( $term_id, 'field_name', true );` If you’re on a Taxonomy Archive page, you can use $pods = pods(); and Pods will automatically …

Read more

Displaying Pagination

Pagination of a list items is supported by Pods Blocks, Shortcodes, and Widgets.

Displaying Pods Custom Settings Pages

ContentsOverviewUsing Pods TemplatesUsing WordPress FunctionsDisplay Pods Settings Pages using Pods Functions Overview You can access Custom Settings Pages for display in your theme using Pods Templates, WordPress functions or with our Pods Functions Calls. Using Pods Templates When you’re using a Pods Template, you’ll reference your fields in your Settings page with the standard magic …

Read more

Image & Media Fields Reference

Shows fields that differ in reference to Image & File Fields

Magic Tags

Show your content and custom fields inside our Pods Templates, like Magic!

Pod Page Template Hierarchy for Themes

Pods supports loading template files directly from the theme for a Pod Page. This requires using the Pod Pages component. ContentsPod Page Templates HierarchyCode referenceExample page URL path: “my/pod-page/*” (Page must be created first)Diagram Pod Page Templates Hierarchy Pod Page Templates can be automatically loaded from the theme when the Page Template dropdown is left …

Read more

Pod Template Hierarchy for Themes

Pods supports loading template files directly from the theme. There are two kinds of templates in Pods: ContentsPod Templates HierarchyExample template: “book-list” (Template must be created first)Plain Templates (Templates component inactive)Diagram Pod Templates Hierarchy Pod Templates can be automatically loaded from the theme when the template code is left empty AND the template name must …

Read more

Pods Blocks

Pods Blocks are available in the Block Editor. They are also available in the Widget Editor (WP 5.8+)

Pods Templates

Create re-usable templates of content that you can put anywhere on your website using Pods Blocks, Pods Shortcodes, Pods Widgets, or automatically inserted in your Single & Archive Post Templates using Auto Templates.

Pods Widgets

Pods Widgets allow you to display fields, a single item, a list of items, and embed a form or template view. Pods Blocks are now recommended instead of using our Widgets.

Post Standard Fields Reference

Fields available to Posts, Pages and Custom Post Types (not including post_meta). Media Library is also a Custom Post Type

Taxonomy Fields Reference

Used for Category, Tags and Custom Taxonomy

Template Tags

Special handling for conditional output or looping through relationships, taxonomy or attached media.

User Fields Reference

User Fields available to Magic Tags when Extended and How to get to and access user_meta with PHP Methods.