You have the ability to get the taxonomies for a given post type. Using the object_type parameter, you can specify that you want to get all the taxonomies for whatever post type. For example, let’s say you want the ones for the Posts. You’d do:
Let’s talk through what you’ve accomplished in the archive template episodes. You’ll add another FAQ too. Then let’s commit the changes to your GitHub repository. You’ve made a lot of changes. It’s time to commit them.
We need a way to categorize the content within the FAQs. Right? Categorization allows you to group the FAQs together for displaying them. For example, look at our Help Center. Each article is grouped and then displayed by a specific topic. We have Pre-Sales, Billing and Payments, and more. These topics are terms. These terms are bound to a custom taxonomy. Therefore, we want to build a custom taxonomy. Let’s call it “topic.”
Now we need to handle flushing the rewrites when our plugin is activated or deactivated. We covered this topic in the Flush Rewrite Rules of the Custom Post Type Basics lab. In that episode, I showed you why you never ever want to flush the rewrite rules after your register a custom post type. Where should we put the activation and deactivation callbacks? Hum. Let me show you a couple of different strategies. As this is a module, we’ll opt to add the callbacks within the module itself. Why? It keeps everything together when you reuse this module. Pop Quiz […]
Next, our custom post type needs further options to be configured, such as the menu icon and archive. Let’s walk through the different options.
Out-of-the-box, when you register a custom post type, the feature supports are title and editor. That’s it. Hum, what if there are additional supports that you want, such as SEO or other custom ones from other plugins? If you have the Genesis framework installed, then it adds 3 feature supports. If you are using Yoast SEO, then it adds 1 feature supports. How do you specify these features when you build your plugin? You use the configuration code that you wrote in Exclude Post Type Features episode, as part of the Custom Post Type Basics lab. That code is reusable […]
The arguments for registering a custom post type are configurable to customize the experience and implementation for your needs. Part of that configuration are the labels. The labels are in the back-end. By default, they will use ‘Post.’ Hum, that will not make sense for the user, content strategist, and anyone who is in the back-end adding, editing, or managing the content. Our job is not just to write code. Nope, you are building experiences. It’s our job to make sure what we build is self-documenting, user-friendly, and draws people in to want to use it. Configuring the labels customizes […]
Let’s build the basic FAQ custom post type. We need to simply register the post type with WordPress. You already did this task in the Custom Post Type Basics lab. Right? Therefore, you have the basic boilerplate code that you can reuse. Let’s copy the code from this lab, which you can find in this GitHub repository. Then we’ll adjust it for our needs. Let’s also talk about how to make this code work within the module, i.e. so that it’s reusable for the plugin that it’s embedded into it. How can we make the text domain reusable? Let’s talk […]
Let’s think about the architecture for this module. How are we going to break up the code into sub-modules, feature sets, and sub-functionality? In this episode, you and I are walking through how to break this module down into its components and keep it centered on a single intent or purpose. How do you break things up and architect your plugins, frameworks, applications, etc.? Focus on the intent and purpose. List out the big buckets of what you’re going to build. Then group the like items together into a logical order where each one supports the single intent of the […]
Way to go! You learned about the different post types and features that are built into WordPress Core. You saw how to check, add, and remove post type features. You saw an example with Genesis of how to add a new post type feature, one that is not built into Core. This lab will help you to do more in your own projects. It also serves as a baseline foundation for custom post types.