Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Bind to Post Types
Lab: WordPress Custom Taxonomy Basics
Video Runtime: 11:55
So far you’ve bound the custom taxonomy to just one post type, i.e. our “team-bios” custom post type. But what if you want to assign it to multiple post types? For example, what if your client wants to assign departments for some of their blog posts? Think about it. Maybe they will write news and press releases and they want to group it by the department. In this episode, let’s assign our new custom taxonomy to both the “team-bios” and “post” post types.
We’ll also talk about interfaces and what’s really going on. The back-end is just an interface that lets users and you interact with the data stored in the database. It’s a user-friendly way of abstracting away complexity.
Therefore, when we bind a taxonomy to multiple post types, it’s just one taxonomy. It might look like two separate in the back-end because it’s shown under the Post and Department menus. It looks like they are separate, but they are not. It’s the same taxonomy shown in two different places in the back-end.
Why is this important for you to understand?
Reason 1: Any changes made to the terms in the taxonomy occur in each of the bound post types. If you add a new term, then that new term appears in the taxonomy for each of the bound post types. In our plugin, it appears in both Posts and Team Bios in the Department taxonomy. Why? Both post types are interacting with the same taxonomy. It’s one taxonomy. Okay, did you get that Aha moment?
Reason 2: The binding and relationship occur in software and the database.
Reason 3: You might be thinking: “I’ll just add departments to the categories for the posts to keep the taxonomies separate.” Why? Why would you do that? It’s duplicating content.
In this episode, you and I will walk through and discuss these points. I’ll show you to make sure it’s clear for you.
Hands off the keyboard. Web development starts by thinking first, then planning it out, and then coding it.
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