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.
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.
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 […]
Exclude Post Type Features
In the last episode, you built a function to handle grabbing all of the post’s post type features. But what if you don’t want all of them? It would be nice to make our new function more reusable by passing in features to exclude. In this episode, you’ll extend your new function by adding the exclude option. We want to exclude trackbacks, comments, excerpts, and custom fields features. You can follow along in WordPress codex. You will use the following PHP and WordPress Core functions: get_all_post_type_supports() array_keys() foreach() in_array() continue()
Configure Post Type Features
In the last episode, you configured the basic post type features including title, editor, and featured image. Let’s add more. And you’ll see how to go grab all of the available features. You will use the following PHP and WordPress Core functions: get_all_post_type_supports() array_keys() You can follow along in WordPress codex.
Configure Labels
You are going to want to configure all the unique labels in the back-end for your client. Listen to me. It’s your job to make it consistent and easy for the user (your client) to use and manage their content. Labels that say “Post” will confuse them. It will confuse you six months from now when you come back to this project. Take the time to configure the labels. It just takes a couple of minutes. In this episode, you will learn about the different label options. You’ll also learn about internationalization with __() and _x(). Since we are building […]
Minimum Configuration
Registering a custom post type takes just a couple lines of code. With two arguments and a slug/key, you are adding our team bios custom post type. It’s very simple. Obviously, you will want more features and functionality. But with that minimum configuration, the starter plugin gives you a team bios CPT. What are public and label arguments? What is the slug/key? In this episode, you are going to change these arguments and see what the results are. Here is the link to the WordPress Register Post Type codex.
Plugin Overview
Make sure you have installed the plugin into your sandbox project. You can get it from GitHub. Let’s walk through the code in this starter plugin to help you see how it’s organized. In this lab, you will be working within this plugin. Over time, you and I can add more functionality to it, such as a shortcode and template page.
What is a Custom Post Type?
What the heck is a custom post type in WordPress? Why do we need it? How does it differ from the post types that are built into WordPress Core? When do you use it? Let’s talk about what makes a post type “custom.”
Lab Introduction
Let me introduce the lab to you and what you will be building.
Laying Out the Theme’s Architecture – Part 2
In this episode, you will continue adding files to your new Genesis developer’s starter theme. You will be adding in the file PHP DocBlocks including the package name. You’ll learn about how to name your packages for the namespacing, which I show as YourCompanyName\ThemeName. Upon the completion of this episode, you will have the baseline theme file/folder architecture completed. This is now the shell of your theme, ready for you to start adding in the code into the appropriate buckets.