What is a hierarchy in post types? How do you use it? Let’s talk about it and how to check for it.
Labs
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
Remove a Post Type Feature
Just as you can add a post type feature, you can also remove one from an existing (registered) post type by using remove_post_type_support(). Let’s say your project needs to remove the featured image from a particular post type that you did not register. You would use this construct to remove it. Let’s go and give it a try.
Add a New Post Type Feature
WordPress gives you the ability to add post type features to existing (registered) post types. You can add any of the built-in features as well as create your own. Why? Why would you want to do this? Maybe your project needs to add one of the features to an existing post type that is either in WordPress Core or some other plugin such as WooCommerce, Ninja Forms, bbPress, BuddyPress, or others. Or maybe you want to add a new one, such as the Genesis framework does. In this episode, you’ll add new features to post and page. And then you’ll […]
What are Post Type Features?
When you register a post type, you configure which features are supported. WordPress provides the following post type features: title editor author thumbnail excerpt trackbacks custom-fields comments revisions page-attributes post-formats In this episode, you will learn about the post type features that are built into WordPress. You’ll go into WordPress Core and look at where it registers post, page, and the other built-in post types.
Get the Registered Post Types
There will be times when you need to grab all the registered post types. Using the WordPress construct get_post_types(), you can specify what you want. For example, you fetch all of the custom post types, built-in ones, or all of them. In this episode, you’ll work with this instruction and go into WordPress core to see what it does for you.
What is a Post Type?
In this episode, you will learn about what a “post type” is within WordPress. You’ll look in the wp_posts database table to see the column named post_type. You’ll see how this column relates to the buckets of content.
Lab Introduction
Let me introduce you to what we are going to do together in this lab. Make sure you have a sandbox site spun up and the starter plugin. You’ll need both of these to do this hands-on lab with me.
WordPress Built-in Post Type Basics
Out-of-the-box, WordPress gives you built-in post types. In this hands-on lab, you will interact and change the built-in post types including the configured features. This is an introduction to post types, which will prepare you for building custom post types.
Custom Post Type Basics
WordPress gives you the means to add new post types. In this hands-on lab, you will explore configuring and registering a new custom post type. You are actively building a team biography plugin, where team members are displayed on a business-centric website.
Wrap it Up
Way to go! You now know how easy it is to configure and register custom post types. This lab was long because I wanted to show you all the options, labels, and discuss rewrites and permalinks.