In this lab, you and I are going to continue building the Team Bios plugin that we did in the Custom Post Type Basics lab. We’ll add a custom taxonomy to it to provide a grouping for the departments. The first step then is to get the Team Bios plugin installed into your sandbox project. If you don’t already have it from the previous lab, no worries as you clone it from this GitHub repository. I walk you through the process in the video, step-by-step: Open up your sandbox project and navigate in terminal to the your-sandbox-site/wp-content/plugins directory. Copy the […]
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.
Explore Other Functions
As you grow in WordPress, you will begin to uncover functionality that is not necessarily documented in WordPress Codex. You’ll find yourself exploring the source code to find the function or construct that you need. Earlier I showed you the get_categories() function. Let’s take a look at some of the other functions that are available to you to work with taxonomies and terms. Don’t be afraid to explore WordPress’ source code. It’s one of your best resources for finding functionality and improving your understanding of it. I show you a shortcode in PhpStorm to exploring all of the functions in […]
Get the Taxonomies for a Post Type
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:
Get the Terms for a Taxonomy
In this episode, you will learn how to get the terms for a specific taxonomy using get_terms. You’ll discover how to show all terms regardless if there are posts bound to them or not. Then I’ll show you a wrapper function called get_categories(), which fetches the terms for the category taxonomy.
Relationship Between Post, Taxonomy, & Terms
Let’s talk about the relationship between the post, taxonomy, and terms. To an author, the relationship looks like it’s the interface where s/he writes and configures the content. But this interface is just a graphic representation of the content in the database. Therefore, this episode is a technical relationship discussion. WordPress gives us a graphic that shows the relationship of taxonomies to their terms. This table shows you that categories are hierarchical, meaning each term can have a child, grandchildren, and so on. Think of it like a tree, where there are levels. Tags and post formats can have just […]
What are Terms?
What is a term? A term is a classification within a given taxonomy. Huh, what does that mean? Terms allow us to further group like content by specifying a specific classification, some group. Let’s talk about it in this episode.
Get the Registered Taxonomies
There will be times when you need to grab all the registered taxonomies. Using the WordPress construct get_taxonomies(), you can specify what you want. For example, you fetch all of the custom taxonomies, built-in ones, or all of them. In this episode, you’ll work with this instruction and go into WordPress core to see what it does for you. Using the get_taxonomies(), you and I can dive deeper into the configuration of each of the built-in taxonomies. Let’s build some code and then see the different options and explore the built-ins. You’ll discover that there are 5 different built-in taxonomies […]
What is a Taxonomy?
What is a taxonomy? What is it? Have you ever stopped to think about it? Why does it exist in WordPress? Let’s talk about it. Let’s look at why it exists and what its purpose is within a WordPress CMS website.
Lab Introduction
Let’s talk about what we are going to do together in this lab. In this lab, you and I are going to explore what a taxonomy is, why it’s needed, and how to use it. We’ll dive into the built-in taxonomies and how they are used too in the content strategy.
WordPress Custom Taxonomy Basics
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.