WordPress Custom Post Types and Custom Fields. What are they? And Why You Should Care!

Divi All Custom Everything…

It is no accident that WordPress is one of the most popular Content Management Systems (CMS) on the planet for creating websites. It is easy to use, very extendable, and it’s free. It is this extendability that allows both experienced coders and your grandparents to build anything from a simple blog to a full-on e-Commerce website with little to no coding knowledge. This is because you can use little blocks of purpose-built code called plugins that are vetted and hosted by the smart people at the WordPress Foundation to extend its basic functionality.

More in this series.

What are Custom Post Types (CPT)?

Default WordPress Post Types

Ready for the elevator pitch on what WordPress Custom Post Types are?

Here we go:

CUSTOM POST TYPES: Custom post types are a way to create your own content types that are specific to your site. Each Custom Post Type you define will have their own set of fields and display options which you can control from the WordPress Dashboard. For example, if you wanted to add an “Recipe” Custom Post Type, the recipe would have its own set of fields for event title, ingredients, time to cook, image, etc.

Yes, mind blown, I know. Your brain is probably already churning with the incredible range of sites you’d be able to build if you could harness this incredibly powerful approach to building truly bespoke websites with Divi and WordPress. And as you’ve probably guessed, Pages and Posts are the baked-in Post Types that come with any WordPress install, each with a specific purpose.

WordPress Pages are used for mainly static content that will rarely change over time and are unique. Think about the landing page for your Divi site. If you displayed something like your business hours on there and they changed, this would be one of the few times you update that. You’ll also usually have a limited number of pages that can often reflect what you have planned for the navigation menu on your site.

WordPress Posts are used to post (yes, I know) regular, timestamped pieces of content. You’d use this packaged Post Type for things like a Blog or News Article. Due to the intended purpose as something that is updated regularly, posts are listed in reverse chronological order on your home page by default (though this can be changed). The structure of WordPress Posts usually doesn’t differ too much.

Now, if you get crazy and install WooCommerce (we ❤️ Woo), you get a new Post Type called Products with its own set of fields that make up those products that will display differently based on the types of fields you completed within each product. By default, this is pretty limited, but 3rd party plugins like Divi BodyCommerce allow you to extend the basic functionality.

What are Custom Fields?

Add WordPress Custom Fields

Ready for the elevator pitch on what WordPress Custom Fields are?

Here we go:

CUSTOM FIELDS: Custom fields allows you to extend your WordPress Post Types by extending the types of information they contain. If you wanted to capture the mood of a blog post author when they wrote the piece, you can add a mood Custom Field without cluttering up your template or theme files with repetitive code.

In the simplest way, Custom Fields adds some extra metadata to your different post types. Different custom fields could be prices, locations, images, etc. Custom Fields are also kind of co-dependant, as they need to live inside of either an Included (pages/posts) or Custom Post Type as they are used to describe that Post Type.

They can also be used as an easy interface for clients to maintain their own websites. Let’s say you have a client that had you build them a website for their restaurant and they wanted to update their menu. You could add the various menu items as fields in a custom menu post type that they can just go in and edit without messing with code or your beautifully designed layouts. Yep, that hit a nerve, I’m sure.

Main Differences Between WordPress Custom Post Types and Custom Fields

When pitting Custom Post Types vs Custom Fields we’ll find a bunch of differences, but they can be narrowed down to a few main ones that we will look at below.

Custom Post Types & Custom Fields Describe Each Other

A Custom Post Type can be thought of a name that summarizes a collection of fields. Inversely, Custom Fields can be thought of a bunch of features that describe the Custom Post Type. If the Custom Post Type is “House”, the Custom Fields might be “Rooms”, “Square Feet”, “Bathrooms”, etc.

Location

A Custom Post Type is added to the sidebar on the Divi Dashboard and you will find Custom Fields inside of a new or existing Custom Post Type.

Functionality

You can use Custom Post Types to display relevant blocks of content on various pages using a WordPress Loop. You can then filter this content with one of the Custom Fields in these Custom Post Types. Using our recipe example, you can display all your recipes on a page using a WordPress Loop, then filter them using a Custom Field on whether the displayed are vegetarian or not.

So confession, the title of this section is a bit clickbaity because, in reality, Custom Post Types and Custom Fields have a symbiotic relationship. They work together to define each other. If you want to build amazing Divi sites that cater to higher-end clients, you need to be using both in perfect harmony. Most people can figure out how to use a drag-and-drop website builder like Divi, but few can master the art of dynamic websites…unless they have the right tools that allow you to implement Custom Post Types WITH Custom Fields.

Let’s look at a couple ways to graduate to all custom everything.

How to Add Custom Post Typed and Custom Fields to Divi

Whether you’re an accomplished coder or Divi newbie, there are two main ways to add Custom Post Types and Custom Fields to your Divi website. Let’s take a quick look.

Custom Code

If you know a bit of PHP or are pretty good at following tutorials, you’ll be up and running with Custom Post Types and Fields in no time. There are a wealth of resources online that will help you learn “WordPress PHP“, but it comes with the drawback that the work does not end with creating these custom elements, to integrate it with Divi, you’ll need to have deep knowledge on how to hook into and display things the way you want it to.

3rd Party Plugins

By far the easiest way to get up and running, especially if you are not a code ninja is to use any of the popular tools out there to add you Custom Post Types and Custom Fields. For Custom Post Types the most popular option with over 1 million installs is Custom Post Type UI. For Custom Fields, there really is no comparison to Advanced Custom Fields.

Combined, these methods will help you get rolling with adding Custom Post Types and Custom Fields to your Divi install. And guess what, over the next few weeks we will show you exactly how to do that in a series of tutorials, lucky you!

But, what happens when you need all this to play nice with Divi and simplify the process even further? Meet Divi Machine, our all custom everything plugin that makes creating new Custom Post Types as easy as having seconds at lunch. Now, this is no bait and switch, we will still show you how to add Custom Post Types and Fields to Divi using both Code and Plugins, but we’ll also walk you through the Divi Machine way in the end.

Custom Post Types and Fields are ALMOST this cool…

Conclusion

There you have it! We hope that after this quick read you have a pretty good understanding of what Custom Post Types and Fields are, but also the insane possibilities of what is possible if you master them. We’d love for you to stick around over the next few weeks as we teach you how to be the Splinter to your Raphaels.

Definitely drop a comment below to let us know what you think, and for sure share any suggestions.

Check these out
The Easiest Way to Add and Display Custom Post Types in Divi
How to Style a Custom Post Type Template using the Divi Theme Builder
How to Get Started with Advanced Custom Fields (ACF) in Divi
How to Add a Custom Post Type to Divi without a Plugin
WordPress Custom Post Types and Custom Fields. What are they? And Why You Should Care!

1 Comment

  1. I understand that reusing acf for custom fields saves development time, but why install one or more plugins, when you could create your own like jetengine does in Elementor and not rely on acf, I think that would be best. I hope that one day they will be like crocoblock is in Elementor and you are in Divi.

Submit a Comment

Explore more from Divi Engine