Arin Adamson
By Arin Adamson | Uncategorized | May 27, 2015

What are Custom Taxonomies

Are you developing a WordPress website? Do you want to break out of the pre-made theme spectrum and start creating your own website specific themes? Then I’d say that you are in the right place. Our previous article was all about custom post types. We talked about what custom post types are, how are they useful and some easy methods to implement them into your custom WordPress theme. This week, we are going to further enhance our custom theme by implementing what are known as taxonomies. Taxonomies can be useful in the organization and structure of your website by classifying and assigning content to specific criteria. This functionality is similar to many other content management systems, so if you have used a content management system such as Drupal you can probably skip over the next paragraph explaining what custom taxonomies are.

A taxonomy is defined as a classification of something. The term taxonomy is typically associated with biology and classifying organisms, however in WordPress we use it to classify posts and content. WordPress comes out of the box with the ability to create and assign posts to categories, which is a type of taxonomy. However, we may need to have more classifications for particular posts, which is where custom taxonomies come into play. You may want to assign all post types to a genre, a food group, a month or some other classification that will help to sort your content on the front end of the website. If this is the case, custom taxonomies are perfect to use.

You can use custom taxonomies in your WordPress website in an array of different manners. The most useful methods are using custom taxonomies to query specific posts, filter posts by classifications and separating content throughout the website based on administrative selections. For example, the popular movie database website known as IMDb, has hundreds of thousands of movies, television shows and other media in their database and the list continues to grow on a daily basis. The front-end of their website would not be user-friendly if it was just one long lists of movies. Also, to update the lists of movies, television shows and other media manually would take way too much time and man-power. We could simplify the process of adding an object to the lists as well as make the front-end more user friendly by using taxonomies. When an administrative user adds a movie, he can use taxonomies to classify the genre, the actors in the movie, the year it was released, the country of origin and much more. Once the movie is published it is then displayed on the front-end, but since it was assigned classifications, we could create a functionality to allow our front-end users to filter out movies based on the taxonomy classifications. This becomes very essential for websites that have a large amount of posts.

To create custom taxonomies for your WordPress website, you can use a few methods. You can go the full manual route, which requires experience and knowledge about PHP. To find out more on how to implement custom taxonomies manually into your WordPress website, view the WordPress custom taxonomy documentation. Alternatively, we can use the same plug-in refereed to in my last article to create both custom post types and custom taxonomies for those custom post types. This plug-in is known as custom post type ui plug-in. This plug-in will allow you to set-up all of the custom post types and custom taxonomies you will need for your WordPress website. Setting up the custom taxonomies is only part of the equation.

The second part of the equation is setting up the functionality on the front-end to show posts by the specified taxonomy. This can be done through the WordPress posts query. When setting the arguments for the call to the wp_query() function, you would include an array argument for all taxonomies you want to filter the posts query by. Take a look at the WP Query WordPress documentation for more information on querying posts by taxonomy. Make sure you understand custom post queries before embarking on this quest.

Custom taxonomies are fun to use and really help with creating advanced functionality in your WordPress website. In the next article we will continue on with our WordPress customization series and go over custom WordPress queries. Don’t just use the default posts query to display posts! Use a custom query to enhance your website’s ease of use and functionality.

background dots

In the time it takes to read this sentence, you could be on your way to a well-oiled demand generation machine. Ready for your blueprint?

yes, i want my Digital blueprint