Code Snippets

Collections of all of our Hook & Filters, Pods Templates and Template Examples

Add Filter for Do Shortcode in Pods Template

Posted in , , ,

If you want to make sure shortcodes are automatically ran against all Pods Templates, this filter will make that change.

Enabling Shortcodes in Pods Templates

Posted in , ,

This piece of code can allow shortcodes to be processed in Pods Templates.

PodsCast #3 Displaying Data Index & Archive Template

Posted in , ,

This particular template is based off of Twenty Fifteen and works for both the Single & Index/Archive & Search.

Create New Record from Form Submission using Add

Posted in ,

Real life example of a function to create a Pods record from fields submitted on a form. <?php function add_new_applicant () { // Get field values from form submission $first_name = $_POST['first_name'] $last_name = $_POST['last_name'] $telephone = $_POST['telephone'] $email = $_POST['email'] $fields = array( 'first_name' …

Read more

Pods-UI Customizations including re-ordering of Fields

Posted in ,

From Andy Fuchs/Tiptronic /* Customize a pod including re-ordering */ $object = pods('test'); $fields = array(); /* collect all fields of the pod into an array */ foreach($object->fields as $field => $data) { $fields[$field] = array('label' => $data['label']); } /* add a WP default field …

Read more

Single Actor Detail from PodsCast #4

Posted in ,

<?php /* Template Name: Actor Detail */ ?> <?php get_header(); ?> <!– Row for main content area –> <div class="small-12 large-8 columns" id="content" role="main"> <?php /* Initiate the Pods Object */ // get the current slug /* $slug = pods_v( 'last', 'url' ); */ global …

Read more

Single-Video Detail from PodsCast #4

Posted in ,

<?php /* Template Name: Video Detail */ ?> <?php get_header(); ?> <!– Row for main content area –> <div class="small-12 large-8 columns" id="content" role="main"> <?php /* Initiate the Pods Object */ // get the current slug global $post; // get pods object // $post->post_type can …

Read more

Archive-Video from PodsCast #4

Posted in ,

Shows how to construct a standard post type archive using Pods functions to control the loop and field display.

Multiple Fields in a Drop Down Relationship Pick List Using a Filter

Posted in , , , , ,

When you need to change what is shown in the drop-down Select Field in a Relationship, you can use this method to base the value on other values in Post Type.

Order by Numeric Field in Shortcode

Posted in

This method can also be used to handle any CAST by specific type order by. <?php /** * WordPress stores all meta fields as strings, which causes problems for ordering by numbers. When using Pods::find() directly, this issue can be addressed by casting the field …

Read more