How To Use Pods For Simple, More Effective Custom Post Types
Pods is a plugin for WordPress that creates Custom Post Types and custom fields. According to the website, “The Pods Framework allows an ordinary user or developer to easily create and extend custom post types, content types, taxonomies, users, media, or comments — helping you keep your content organized and speed up the development of your project.”
What is a Custom Post Type?
Pages, Posts, Attachments, Revisions and Nav Menus are the Post Types built into WordPress core – Post Types are then, essentially, types of content. Custom Post Types are post types that are created in addition to those bundled with WordPress core. When you realize that your website needs or could benefit from a content type that is different to the default types, a CPT is probably what you should use.
What about Taxonomies and Custom Fields?
In WordPress, a taxonomy is a means of classifying content. I find them helpful in organizing and grouping content.
Custom Fields are metaboxes that are used to input metadata that is related to your post. When you add a new post in WordPress, you’ll see these draggable boxes which are used for to store information about your post. Examples are author and excerpt. Another is custom fields. If you can’t see custom fields, click on the Screen Options tab and check the Custom Fields box.
Using CPTs in WordPress
Many commercial themes have CPTs built into them. If a theme you purchased/installed has “Testimonials,” “Team,” “Recipes” built in … those are CPTs added into the theme for custom content. In the cases of these commercial themes, a custom post type (CPT) has been added to the theme’s functions.php file (or a must-use plugin). This is not recommended, because if the theme is changed, the custom post type will be gone.
A better way to add a CPT to your website is with a plugin. You can create your own plugin.
Or you can use a plugin that is already built, tested and available, which may have some advanced functionality included, such as custom taxonomies, relationships and templates. There are a number of excellent CPT plugins for WordPress.
I have used Pods on the last few websites I have built. I learned about it from a tutorial on Sridhar Katakam’s website, and have found it comes in handy on many different types of websites. Pods lets you create custom settings pages, and even advanced content types (ones that don’t use the default WordPress tables in the database, but instead create their own). You can also extend the existing content types, taxonomies, media, users, and even comments. Pods is community-driven, supported by a non-profit foundation, and support on Slack is great (@ has been very patient with me!). There are also many tutorials– some in in video form – which are helpful walk throughs, some more advanced than others. I recently heard an interview with @, Community Manager for Pods, on Lee Jackson’s WPInnovator podcast, where he talked more about Pods and Easy Pods and what it can do.
For someone like me who has not mastered php, but has a good sense of how things should work and look, Pods Templates have been very helpful. These templates are an optional component you can enable to create templates for archive and single post pages using magic tags and shortcodes all within WordPress without messing around with theme files.
Pods Use Example
I recently created a fairly simple website for a law firm. They had several hundred cases in PDF format, which they wanted on their site, indexed by year, case type, lawyer and court. I created a CPT called “Cases” and then created Taxonomies for Case Type 1 (Substantive Expertise) and Case Type 2 (Procedural Expertise) , Court and Lawyer. Within the Cases CPT, I created 3 custom fields: Case PDF, PDF Title and Year.
To set up the Cases CPT/Pod, I went to Pods>Add New. A set up window helps you assign the singular and plural name for the CPT. This is what will show in the Admin bar on the left of your Dashboard, near Posts and Pages. The next screen has Custom Field set up options, as well as other settings for the Admin UI and Labels.
For the Custom Fields, you can select which type of field should be used from a dropdown menu:
In the Admin Ui screen, you can use a custom icon to replace the default “pin” icon assigned to Posts.
Under “Advanced” you can set which screen options will be supported in the CPT, as well as which taxonomies are built in.
As I mentioned above, I created 4 custom taxonomies for this website. Setting up custom taxonomies is the same general idea as a CPT. Go to Pods > Add
New and select Taxonomy from the Content Type dropdown.
On the Admin UI tab, check the box to show the Taxonomy column on Post Types. This will allow you to select the Taxonomy within the Post editor, as you would with Post Categories in regular WordPress posts. I have found that having “Hierarchical” checked in the Advanced Options also helps with this. Note that if you have no taxonomies created yet, this section will not show in the Post Editor.
There are a few ways to display the CPTs. By default, these will use the single.php and archive.php templates. You can create your own custom page templates, and I often do – this is very easy in most themes, and especially in Genesis framework themes, which I use exclusively.
With Pods, you can also create quick and easy templates using the built-in Template feature. On this law firm site, I used this for the very simple pages I needed.
For the CPT “Cases” I created a template that displays the PDF file link, with a “download/file” icon and the title of the case. Pods uses “magic tags” to help assign content to the template code.
In the Cases Pods Admin, I checked the box for the template to add the “Cases” template I created to the existing single.php template.
For the custom taxonomy, I created a template for the Archive page, and overwrote the archive.php with this template:
Search and Filter
There are several plugins that help provide advanced filtering in searches on your website. For this law firm website, I used the Search and Filter plugin and some css to create a custom search box.
Pods can do MUCH more complex stuff … this is very basic, but it is a good start if you are looking to dip your toe into using Custom Post Types to organize your content.
If you want more a much more detailed comparison of CPT plugins, check out this amazing document by Scott Kingsley Clark (lead developer for Pods) and Matt Gibbs.