Blog

WordPress Custom Post Types and Advanced Custom Fields

WordPress Custom Post Types and Advanced Custom Fields

One of the top reasons we like to build websites with WordPress is that it is very user friendly for our clients to create and manage their own content.  It’s an intuitive to use content management system (CMS) for the average non-developer user, which can’t be said for some of its open source competitors such as Drupal or Joomla.  This is one of the many reasons why WordPress accounts for over 65% of all CMS based websites and nearly 43% of all websites in the world, and is only increasing the market share for each.

As intuitive as WordPress is for the new user, I can still recall about a decade ago when I first starting working with it being initially perplexed by what the difference between pages and posts is.  One part that is confusing is that WordPress pages and posts are each different kinds of “post types”.  Once you understand that nuance, and that a “post type” is simply a convenient way to categorize and sort different types of content, you realize just how useful this can be.  For the above specific cases, a “post” is used to display the content for blog post articles and a “page” is used to display the content for static pages on your site, such as the home page, the contact page, etc. but they are both categorized (and stored in the database) as “posts”.  Perhaps if WordPress was starting again from the beginning they’d consider calling them “content types” to avoid the confusion, but alas WordPress got its start as a blogging platform where blog posts were its bread and butter, so that nomenclature stuck.

Here’s the cool part though, and what makes the organization into post types easy to work with:  You can create any kind of custom post type you want, and use this categorization to display content by post types.  In fact, if you already have a WordPress website, it’s likely you work with these custom post types already.  Does your website feature events, products, testimonials, or staff profiles?  Those are all different post types that your theme or an installed plugin created.  How about services, portfolio items, or projects?  Those are all custom post types as well.  What’s nifty about having the content sorted that way, is it makes it easy to feature all content of a certain type in one place, such as a scrolling list of testimonials on the home page, or a grid of staff member bios on the staff listing page.

So themes and plugins can create custom post types for you, and often that is the best way to go, but what if you have your own needs that don’t fit into any generic box?  Maybe you run a local zoo or wildlife refuge and want to have a separate profile for each of your animals.  You’d like it to be easy for your administrators to login to the site and add and edit all of the descriptions, images, and other vital information to display on the website.  You need to create a custom post type of “animals’.

There are a number of ways to accomplish this, but they fall into two categories:  use a plugin, or write some custom code.  While the coding part isn’t terribly difficult, it certainly should be left to an experienced WordPress developer.  Coding does has the advantage of keeping things lean and not tied to a plugin that could change or go away altogether, but in our experience using a plugin is the best approach for all but the absolutely simplest of applications, especially because the plugin we recommend, Custom Post Type UI, is so darn simple to use and lightweight (ie. doesn’t bog down your site).  Some of the competitors out there tend to create some unnecessary overhead, but Custom Post Type UI just handles the basics of registering a new post type using a straight forward GUI.

So you’ve created your new custom post type of “animals” and are ready to start creating content.  You’ll notice that on the sidebar admin menu when you logon to WordPress you’ll see a listing for “Animals” with the same kind of options as for “Posts” and “Pages” (ie. All Animals, Add New, etc.).  You go in to create your first animal, but you realize that there is only a simple content field available.  Wouldn’t it be handy if you had specific fields for all of the attributes you’d like for each animal such as species, weight, habitat, diet, etc?  That’s where another of our favorite plugins comes into play, Advanced Custom Fields (ACF).  With ACF you can add any type of content field you could imagine to your new custom post type:  text, date, image, files, maps, buttons, repeater fields, etc.  Bringing together Custom Post Type UI and Advanced Custom Fields makes customizing the content you create on your WordPress website virtually limitless.  In fact, we like ACF so much, we offer a free Advanced Custom Fields Pro license to all of our clients who are on a recurring security and performance plan.

The tricky part comes when you want to display all of this custom content you’ve created.  Custom Post Type UI has a premium plugin option that provides some framework for the basics without coding (it has a built in shortcode builder), but your best bet is usually to work with an experienced WordPress developer to build custom page templates to display and style your content just how you’d like.  For that matter, if you’re new to custom post types and custom fields and don’t consider yourself to be a WordPress enthusiast or do-it-yourselfer, it’s generally best to save yourself the learning curve of the aforementioned plugins and work with a team of experts.  The plugins do allow you to forgo any coding and the documentation is extensive, but ultimately you’d likely be better served spending your time working to build your business or fine tune your organization rather than fumble around with plugins.

With the above in mind, if you are looking to create some snazzy new custom content on your existing WordPress website, or you need to create a new website that allows for such flexibility, we’d love to learn about your project and help you out!

Share this post!

Leave a reply