Professional Documents
Culture Documents
http://pods.uproot.us/user_guide
WordPress has two main content types out-of-the-box: blog posts and pages. The Pods plugin allows you to
create, manage, and display custom content types in WordPress.
Pods physically breaks out each new content type (pod) into their own database table. This is for efficiency as
well as the ability to connect data from different content types. Other CMS plugins "hack" blog posts by storing
data into WP Custom Fields. The disadvantage of this approach is that Custom Fields make it all but impossible
to find and display groupings of similar items.
Pods makes it possible to create a content type, such as Events, and easily pull in items that match certain
criteria. E.g. Find all past events in Virginia attended by John Doe.
If you've been looking for a clean, lightweight alternative to Drupal/CCK or Joomla, then look no further.
1.3 Installation
1. Unzip the pods folder into wp-content/plugins/.
2. In Settings > Permalinks, set the Custom Structure to /%postname%/.
3. Enable the plugin through Plugins > Installed.
<h2>{@name}</h2>
<p class="date">Starts on {@start_date}</p>
<p class="description">{@body}</p>
List and Detail Templates don't allow for PHP code, but they do support Magic Tags: {@column_name}. Magic
Tags simply pull in the value of the respective column. {@detail_url} is a placeholder Magic Tag, and can be
swapped out for a custom URL if needed.
<?php
// Start using the "event" pod
$Record = new Pod('event');
<?php
// Fire up the Pod class
$Record = new Pod('event');
<?php
// Find the ID from the URI
$uri = explode('/', $_SERVER['REQUEST_URI']);
$id = $uri[2];
Create a "slug" column in your event pod (name it "permalink" for this example).
In the event pod's List Template box, replace {@detail_url} with "/events/{@permalink}/".
Create a new PodPage called "/events/*/", and enter the following code:
<?php
// Find the slug name from the URI
$uri = explode('/', $_SERVER['REQUEST_URI']);
$slug_name = $uri[2];
2.2 Templates
Templates are used for customizing the look and feel of certain data pulled from the database. Templates support
HTML, CSS, and Magic Tags. Magic Tags are little bits of code used to pull column values into templates.
List Templates are used for displaying groupings of items, whereas Detail Templates display information on a
specific item. Multiple templates can be pulled into PodPages or WP Template files.
<p><a href="{@detail_url}">{@name}</a></p>
<h2>{@name}</h2>
<div class="italic">Created on {@date}</div>
<div class="content">{@body}</div>
2.2.3 Usage
This code goes into either a PodPage or a WP Template file (in the active theme folder).
<?php
$Record = new Pod('event');
$Record->findRecords('id DESC', 15);
echo $Record->showTemplate('list');
?>
The above example demonstrates how to call a List Template using showTemplate(). Below is an example of
how to implement the Detail Template.
<?php
// Find the ID from the URI (modify this code if needed)
$uri = explode('/', $_SERVER['REQUEST_URI']);
$id = $uri[2];
<?php
$override = '<p><a href="{@detail_url}">{@name}</a></p>';
echo $Record->showTemplate('list', $override);
?>
<?php
// Bypass the List Template
$Record = new Pod('event');
$Record->findRecords('id DESC', 15);
while ($Record->fetchRecord())
{
// Display the "start_date" column
echo $Record->get_field('start_date');
}
?>
<?php
// Bypass the Detail Template
$Record = new Pod('event', $id);
2.3 Helpers
Helpers come in 3 different flavors, and each "flavor" serves a distinct purpose.
2.3.1 Display
A display helper's purpose is to modify a column's value before outputting it to the user. These are column-level
functions that can be called in the following ways:
1. Column edit box: display helpers can be defined from the column itself. If used, the column's value
would be modified globally.
2. Magic Tags: a display helper name can be entered as the 2nd parameter within a Magic Tag. If so, the
column's value would be modified for this instance, but not globally.
3. PodPages: after you've defined a new Pod(), you can use pod_helper('helper_name', 'column_name');
?>
2.4.1 Format
This is the format in which to use Magic Tags within templates.
{@column_name[,display_helper][,before_text][,after_text]}
// The item's ID
{@id}
<?php
$override = 'state,country';
echo $Record->getFilters($override);
?>
Lastly, you can change the label of the submit button by using the 2nd parameter:
3.1 Roles
This document details the installation and usage of the Bed Data Demo application software.
3.2 findRecords()
The findRecords() function allows you to customize which items to display for any item listing.
3.2.1 Format
findRecords() supports 4 optional parameters:
event person
id id
name (txt) name (txt)
start_date (date) first_name (txt)
location (desc) last_name (txt)
attendees (pick person) date_of_birth (date)
email (txt)
*NOTE* prefix all non-PICK columns with t., and all PICK columns with the pick column name [dot] the pick's
pod column to use (e.g. "attendees.first_name").
<?php
$Record = new Pod('event');
$Record->findRecords('name ASC', 25);
echo $Record->showTemplate('list');
?>
3.3.2 Usage
When your menu structure is ready, use pods_navigation() within a PodPage or WP Template file to display it.
<?php
// Display items from Home up to 1 level deep
echo pods_navigation();
or…
<?php
$fields = array('name', 'date', 'email');
echo $Record->publicForm($fields);
?>
<?php
$fields = array('name', 'date', 'email' =>
array('default' => 'foo@bar.com'));
echo $Record->publicForm($fields);
?>
If you want to set a field default while hiding the field (so it can't be changed):
<?php
$fields = array('name', 'status' =>
array('default' => 'Submitted', 'hidden' => true));
echo $Record->publicForm($fields);
?>
3.6 Relationships
Relationships are created using PICK columns. A relationship column is essentially a select list, which shows all
the items of the related pod (or category) and allows you to select which items to relate to.
When creating a new pod column, you have the option of selecting which column type to use. Select PICK from
the dropdown menu. Another dropdown will appear with a list of Pods (and categories) that you can relate to.
Relating to a category
You can also relate a column to a parent category (a category with children). If you have any categories with
children (e.g. "Document Type"), then that parent category will show up in the relationship dropdown after
selecting the PICK column type.