Skip to toolbar

Include and Init the Pods class

Function Definition

function pods ( $type = null, $id = null, $strict = false )

Source File: /pods/includes/classes.php

Parameters

PARAMETER TYPE DETAILS
$type (string) The pod name
$id (mixed) (optional) The ID or slug, to load a single record; Provide array of $params to run ‘find’
$strict (bool) (optional) If set to true, returns false instead of a Pods object, if the Pod itself doesn’t exist. Note: If you want to check if the Pods Item itself doesn’t exist, use pods::exists().

Returns

(bool|Pods)

Examples

Add Default Values To Fields

 Output a Pods Form for Pod ‘fruit’ with two fields, ‘yellow_fruit’ and ‘blue_fruit’ with the field ‘yellow_fruit’ pre-populated with the value ‘Banana’.

Use strict mode and pods::exists() to avoid errors if Pod or Pod item do not exist

Illustrates the difference between strict mode, which returns false if the pod does not exist, versus pods::exists()

display

Return the output for a field.

fields

Return field array from a Pod, a field’s data, or a field option

find

Find items of a pod, much like WP_Query, but with advanced table handling.

pagination

Display the pagination controls