Contents
Overview
The power of templates allows you to pull fields from your Custom Post Types & Taxonomies (and any other Pod type) and display them on the front-end. Pods Templates are designed to output content on the front-end of your website (or anywhere you want to use them) by running your posts through them in a loop or once for a single item. Templates can be called from a Block, Shortcode, Widget, or using our Auto Templates.
If you do not see the menu option for Pods Admin > Templates, you will want to enable Pods Templates by activating the component under Pods Admin > Components.
Creating and using Pods Templates
Saved Templates (reusable)
In Pods Templates, which are accessed under Pods Admin > Templates. This allows you to create re-usable templates that are stored in the database and can be called specifically in your shortcodes using template="Name of Template"
, in the Blocks / Widgets in the Template drop-down lists, or within the Auto Templates configuration.
Here’s an example of how to set the template used in a Shortcode.
[pods template="Name of Template" ...]
Custom Templates (not reusable)
In Custom Templates, which is the ‘template’ between the Pods starting and ending shortcode tags. You can use Magic Tags within the Custom Template will be output by the shortcode. You can also access the Custom Template in the Pods Single Item Block/Widget and Pods List Items Block/Widget.
Here’s an example of how to customize the template used in a Shortcode.
[pods] anything in here is the Custom Template [/pods]
Limitations
You can put anything you’d like in your Pods Templates as long as you recognize that whatever is in that template will be included multiple times when Listing Items or in Archive views. If you intend to add JavaScript or CSS, we recommend you place those assets directly into your own plugin, theme, or child theme.
To embed shortcodes within your Templates and have them work (apart from our special template tags) then you will need to enable that with the wp-config.php constant:
define( 'PODS_SHORTCODE_ALLOW_SUB_SHORTCODES', true );