In the previous article we talked about custom post types. They are the key bricks to be used in your web application that goes beyond simple blogging. But they are not enough. Your custom piece of information most likely needs to be categorized in some way and even more likely it will have some additional info like price, location, etc. that you want to show in a structured way. If this is the case, you need to learn about taxonomies and custom fields.
The definition of taxonomy may sound a bit complicated but you can think of it as a category type. We all know Categories and Tags for Blogs. They both are taxonomies and they both are used to categorize our posts in some way. If you need another category type e.g. “color”, then you need to create a new Taxonomy and link it to your own post type. After that, when creating a new post entry, you will be able to choose or assign a color. The color itself e.g red or green is called a Term for the “color” taxonomy.
There is a bunch of settings for taxonomies as well as for custom post types. But there are only two you really need to understand to get started.
- The first one is the link between the taxonomy and the post type. You will not be able to use a taxonomy and its terms unless you assign the taxonomy to the correct post type.
- The second one is whether your taxonomy is Hierarchical or not. The difference between them is best understood if you look at the standard post Categories and Tags. Categories are hierarchical but Tags aren’t. See the picture below.
To create a new taxonomy, you may use the same tools as for custom post types like Custom Post Type UI. These tools provide easy to use interface for creating and configuring taxonomies.
A Custom field is a field that you may create and assign to your custom post type to show some additional info. For example, let’s say you want to sell bicycles online. The first thing you need to do is to create the custom post type “bicycle”. Then you need to create the custom taxonomy “bicycle _type” to categorize bicycles by type like Mounting or Cruiser. Then you most likely need the custom field like “Price” to display a price.
After that your shop is almost ready. You just need to add a payment system to it. Of course, in most cases you will use all-in-one solution for your online shop like WooCommerce but you don’t have to. If you understand custom post types, taxonomies and fields you can build the online shop yourself.
Custom field is the technology built-in in WordPress. But most likely you will not enjoy using it. The de-factor standard way to work with custom fields is to use the Advanced Custom Fields plugin. It has more than 1 million active installs and every developer knows how to work with it.
After you master it along as well as any plugin that creates custom post types and taxonomies you are almost ready create a website for any business area with unlimited custom information.
The only thing that is still needed is to display the custom information. Unfortunately, it is the trickiest part. Even though there are some not very cheap plugins that help to do it, they are still not perfect and it is unlikely that you may get away from coding for a more or less advanced website.