Pod Template Hierarchy for Themes

Pods supports loading template files directly from the theme.

There are two kinds of templates in Pods:

  1. Pod Templates component that lets you create reusable templates across your site
  2. Plain templates that you provide through custom code within the corresponding Pods Block or Pods Shortcode context

Pod Templates Hierarchy

Pod Templates can be automatically loaded from the theme when the template code is left empty AND the template name must only contain allowed characters: alphanumeric, dashes, and forward slashes (/)

Code reference: $obj will be provided to your file and it will contain the current Pods object with all of the context available to it.

Example template: “book-list” (Template must be created first)

Template Hierarchy (in order of existence check)

  • pods/templates/book-list.php (new path added in Pods 3.2.8+)
  • pods/book-list.php
  • pods-book-list.php
  • book-list.php
  • There is no generic catchall file

You can customize this list using the filter pods_template_default_templates and override the array of files provided (without the .php extension).

When providing custom code to use in the context of a Pods Block or Pods Shortcode (even with the Templates component active) — those templates are treated as Plain Templates. See the next section for how Plain Templates work.

Custom options

You can specify custom PHP header information to enable specific options. Right now there’s only one option available.

Enabling Magic Tags

<?php
/**
 * Pod Template: Your template name
 * Magic Tags: Enabled
 */
?>

Your pod template goes here

Plain Templates (Templates component inactive)

When not using the Templates component in Pods, those templates are treated as Plain Templates and are restricted to only supporting magic tags and do not have a mechanism for file-based templates.

Diagram

Here’s a handy diagram that you can use to reference for Pod Template Hierarchy.

A diagram showing the template hierarchy used for Pod Templates in Pods.
Pod Template Hierarchy diagram

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

Pods Blocks

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

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.

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.