WordPress gives you the means to add new custom taxonomies. In this hands-on lab, you will explore configuring and registering a new taxonomy for the team biography plugin you built in the Custom Post Type Basics lab. Plus, you learn some basic PHP string building and handling.
You are going to be amazed at how easy it is to configure and register your own custom post types. When your project needs a portfolio, event, FAQ, glossary, team bios, or whatever special content classification, you will know the ins and outs of how to add these to your project.
What Will You Learn?
This lab will teach you the basics of taxonomies, PHP, and more. You’ll learn:
- What the heck is a custom taxonomy
- Why would you want to create a new one
- When to create a new one
- Improving the user experience by configuring labels for the interface
- PHP Basics of working with strings including:
- The concatenating operator
.=
and how it processes smooshing strings together - Inserting variables and functions into a string with the concatenating dot
- Working with formatted strings using
sprintf
my preferred approach
- The concatenating operator
- Binding a taxonomy to more than one post type
- Flushing the rewrite rules when activating, deactivating, and uninstalling the plugin
- Working with git
-
Want to cheat and look at the code you will be building? Click here to access it.
Prerequisites
In order to do this lab, you will need:
- Your local sandbox site spun up and ready to go. See this Help Center article to get your sandbox ready.
- The team bio plugin you built in the Custom Post Type Basics lab
You will want to do these labs first:
Don’t repeat yourself. Don’t repeat yourself. Don’t repeat yourself.
Episodes
Total Lab Runtime: 01:30:53
- 1 Lab Introductionfree 08:15
- 2 Custom Taxonomy - The What, Why, and Whenfree 08:32
- 3 Registering a Custom Taxonomypro 09:54
- 4 Configure the Labelspro 14:51
- 5 Bind to Post Typespro 11:55
- 6 Configuring Argumentspro 07:52
- 7 Render Entry Footer Termspro 08:40
- 8 PHP 101: Concatenating Assignment Operatorpro 02:26
- 9 PHP 101: Building Stringspro 08:19
- 10 Test Entry Footer Termspro 03:03
- 11 Flush Rewrite Rulespro 03:56
- 12 Wrap it Uppro 03:10