Pods – the WordPress secret weapon
10 September 2020
WordPress is pretty good. This site is built on it and we use it for a lot of client projects. Pods makes it really good. Pods is a plug-in that allows you to add in custom content types, custom taxonomies, extend relationships, eat healthier, become happier and a better person.
This is different than Advanced Custom Fields (ACF) – Pods is, well, bigger and allows for more customization. ACF is good but sometimes it’s not enough.
Corporate Alert is a non-profit project that aims to collect a vast amount of public data on corporations and link it all together. For example, one goal is to connect worker safety complaints from OSHA with vehicle recall information from NHTSA. Both sources of this data are public but they live in two separate databases that have no connection to each other. To even know they both exist is to have a black belt in geekery. Using Pods we created custom content types for each data source (auto recalls, worker safety, etc.) and linked them via a custom taxonomy that is the company name. As a bonus we can add in biographical information about a company.
Custom content types and custom taxonomies are cool but our favorite feature of Pods is Magic Tags. Magic Tags are Pods template language that allow you to create if/else loops, easily bring in the custom fields you created and more. On the Corporate Alert site they are used extensively. On company listings the following is used to display a companies logo if one exists. If it doesn’t exist then it will print the name as text.
[if logo]
<a href="/company/{@company.slug}"><img src="{@logo._src.medium}" alt="{@company} logo"></a>
[else]
<a href="/company/{@company.slug}">{@company}</a>
[/if]
The Corporate Alert project is a work in progress but could not be built without Pods. Well… it could be built but not in WordPress.
Got a better way? Love or hate Pods? Let us know.