Creating, managing, and displaying custom post types using the Pods Framework plugin for WordPress Part 2

Okay we’re back for some more details on how to use the Pods Framework plugin to create, manage and display Custom Post Types.

Step 6 – Go ahead and set-up your fields. You’ll see that there’s a variety of options – text input, text area, etc. It should be fairly self explanatory. Here’s a screenshot of the Name field in my example.

Detail of the Name field
Detail of the Name field and it’s options
Make sure to check out the other Field options under the Additional Field Options and Advanced tabs as this can provide additional functionality.

Step 7 – Setting up Pods templates to manage how you display your Custom Post Type. You should have activated the “templates” component inside the Pods plugin. If not, do so now. Then under the Pods menu select “templates”. Click the “Add New” button at top to create a new template.

Pod's templates screen
Pod’s templates screen

Step 8 – You should now see a screen similar to this (obviously blank if it’s a new template).

Pod's template edit screen
Pod’s template edit screen

I use a pattern of creating two types of templates – a list template (for displaying a paginated and linked list of all the posts of my custom post type) and a detail template (for showing the specific details of a specific post of that custom post type). You see in the content area I have the following:

<p>
<a href="/wp-Pod-testing/team/{@member_id}">{@member_name}</a>
</p>

The {@member_id} is special template code that Pods understands – it says “look for the Pod field with this ID and place it right here.” I’ll show you how we’ll use this in the next step.

Step 9 – So let’s say you’ve created your two templates – a list view of all posts of your Custom Post Type and a detail view for an individual post of your Custom Post Type. Great. But how do we display it?
Let’s create a page. Name it (I should say change the permalink) to be exactly the same as the name of your Pod – in my example, “team”.

Pod ID
The Pod id

Step 10 – The magic: Pod Shortcode.

Pod shortcode
Pod Shortcode

So right above your Content Editor is a small green leaf icon which is the Pods shortcode utility button. Click it.

Step 11

Pods shortcode embed screen
Pods shortcode embed screen

Select “List Multiple Pod Items” if you’re doing a list display of your custom post type (do this on the page that you’ve named to reflect the ID of your Pod you want to display).

Step 12
Nothing will display in the list until you start creating new posts under your new Custom Post Type which will appear on your left sidebar in your admin screen.

CPT Admin
The Custom Post Type, created by Pods is now available for use.
So let’s go create some posts under our new custom post type.

Step 13 – Similar to Step 9, we will create a new post (in our custom post type), and using the Pods Shortcode button, we will embed the Fields data of our Custom Post Type post, using Pods template system, into the Content Editor of the post.

Pod CPT Post screen
Pod CPT Post screen

Some things to note: the slug is very important – it’s what tells the Pods Framework to display a specific post. The other important detail is the template which will tell Pods which fields to grab and display.

Conclusion
So here we’ve used Pods Framework plugin to create a custom post type, create list templates and detail templates to manage the display of our Pods data, then using the Pods Shortcode button above our Content Editor, we can easily embed that data into our pages, standard posts, as well as our custom posts types. Is this the best way of displaying data from a Pod? That depends. For the ultimate customization as far as display goes, I’d go with creating custom page templates in your theme. But if you don’t want to touch your theme files and want to avoid writing out a lot of code, the approach we covered here and in the last post works really well. This also highlights the power and flexibility of the Pods Framework.

Creating, managing, and displaying custom post types using the Pods Framework plugin for WordPress

This will be a bit of a tutorial on how to use the Pods Framework plugin to create, manage, and display custom post types in WordPress.

First: Why use Pods as opposed to other options? One reason I like Pods is that you don’t have to write out a whole bunch of boilerplate code and create custom page templates to display your custom posts (although you certainly can if you want or need that depth of template customization). Pods also provides more flexibility by allowing you to use separate database tables to contain your custom post type as opposed to stuffing everything under the WordPress meta table (the default WordPress Custom Post Type behavior or like most other custom post type plugins).

So Step 1 install and enable Pods on your WordPress installation. (You don’t need a screenshot for this do you?) I would recommend you do this on a local development install first so you can get an idea of what’s happening before trying it on your site.

Step 2 – Configure your Pod and enable some useful components.

Pods admin menu item
Pods menu

I recommend enabling Advanced Relationships, Packages (import and export your Pods – great way to test locally and then import into your live environment), and Templates.

Pods component screen
Pods component screen

Step 3 – come up with a great idea for a custom post. In my case, I wanted some functionality where we could manage a team by adding and removing members and displaying pertinent information about individual members.

Step 4 – Create a new Custom Post Type using Pods (under the Pod’s Admin, select Add New).

Add new Pod
Add new Pod

Pods will ask you to fill in some information – don’t worry, you can always come back and update things after you’ve created it. In our case it will ask what type of object you’re creating (Custom Post Type (CPT), Custom Taxonomy, or even custom Settings Page). Select CPT (Custom Post Type).
Creating a new Pod
Create a new Pod

Fill in the labels – the single label is what a single item will be called, the plural is what multiple items will be labeled. If you have enabled Pod’s Table configuration you can select the Advanced setting and configure it so your Custom Post Type will use it’s own database table (as opposed to using the meta-based which is WordPress’ default). Be aware of the pros and cons of using this feature – a separate database table means more calls to the database but with the additional flexibility that can come from having a separate table.

Step 5

A Custom Post Type Pod
A newly created custom post type Pod

Now it’s time to add in Fields for your Pod. Fields are a way to capture the information you want that relate to your Custom Post Type. In my case I want to capture the Name, Job Title, Email, and Photo. The id field I included as a way to query for the slug ID of the post – basically it’s useful info for behind the scenes and not used in the public display. I’ll cover why I did that later in this post.
Manage Fields screen
The “Manage Fields” screen

Please note the Name column – this is the name/ID that you’ll use when pulling and displaying data from an individual item in your Pod.

Okay we’ll call it quits here (this post is getting fairly long and heavy with images). I’ll pick it up in the next post.