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()
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.
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 […]
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.
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 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.”
Do you need to include the optional parameter taxonomies when registering the custom post type register_post_type()? How do you link the taxonomy and post type? In this quick tip, Tonya shows the how and why of the `taxonomies` optional parameter.