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 […]
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.
Build the Basic FAQ Custom Post Type
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 […]
Module Architecture
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 […]
Lab Introduction
Let’s talk about what you are going to do and build in this lab. We’ll talk about why. Why are we adding this FAQ feature? We’ll talk about what you’ll learn and the expertise you will gain after doing this lab with me. This lab is awesome. It has advanced plugin development concepts and processes. It will help you to move forward in your plugin development career. Don’t worry. I’m going to walk you through the entire process, sharing how I’m thinking about it, why we’re going in a particular direction, and alternative strategies. Ready? Let’s get to work.
What is a Hierarchy?
What is a hierarchy in post types? How do you use it? Let’s talk about it and how to check for it.
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 […]
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.
Configuring Arguments
In this episode, you will walk through the remaining configuration arguments. You’ll add a different menu icon, adjust the rewrite slug, remove it from the menus and admin bar, enable the archive, and more. Most of these you will not need to touch. However, you need a good overview to see what is possible. You can follow along in WordPress codex.
Flush Rewrite Rules
In this episode, you will learn about why, when, what, and how of flushing the rewrite rules for your new custom post type. You’ll learn about permalinks, Rewrite API, and how the page request is mapped through the rewrite rules to figure out what record to pull from the Posts database table. The starter plugin you got at the start of this lab has the rewrite the right way. It’s attached to the plugin activation event. That is the right way to do it. Why? Rebuilding (flushing) rewrites is an expensive process. It takes a lot of time to do […]