A Cozmoslabs Product
Documentation / Swift Templates / Create Taxonomy Single Templates with no coding

Create Taxonomy Single Templates with no coding

Custom Taxonomies offer a great way of grouping your Custom Post Types (including Posts and Pages) in WordPress.

WordPress Creation Kit helps you create Custom Taxonomies and attach them to a Custom Post Type (Post or Page) as well as build your Taxonomy Single Template with no coding, directly from the WordPress admin UI.

Creating a Custom Taxonomy using WCK

Creating a Custom Taxonomy is done in just a couple of clicks using WCK Custom Taxonomy Creator.

Let’s say we have previously created a Custom Post Type called “Movies” for which we need a Custom Taxonomy called “Genre”.

This will help us categorize our movies into different genres like: comedy, action, drama, etc.

We’ll use WCK Custom Taxonomy Creator to define our new Custom Taxonomy called Genre and attach it to Movies Custom Post Type.

WordPress Creation Kit - Swift Templates - Genre Taxonomy

Once added you’ll notice the Genres box attached to the Movies edit screen.

WordPress Creation Kit - Swift Templates - Comedy Movies

A look at the Taxonomy Single Template

Now let’s assume we want to have a Page called “Comedy” that displays all the Movies which have the Genre: Comedy.

Inside each Movie Single Template we want to display certain Custom Fields information attached to the Movies Custom Post Type.

Our Taxonomy Single Template will therefor contain the following information:

  1. Movie Title
  2. Description
  3. Genre
  4. Movie Information
  5. All Movie Actors information

Create Taxonomy Single Template with Swift Templates

Swift Templates allows you to build a Taxonomy Single Template with no coding using an intuitive UI.

We’ll go ahead and create a new Swift Template by clicking “Add New” in the Swift Templates interface. Then we can select the Custom Post Type that our Single and Archive Pages will be based on. Go ahead and select “Movies”.

WordPress Creation Kit - Swift Templates - Custom Query Arguments

After we will install a WCK Swift Templates add-on called WCK Custom Query Arguments that will help us create more advanced queries.

Just install this add-on like any regular plugin and after activating it, in Swift Templates you will notice a tab called “Custom Query Arguments”.

WCK Custom Query Arguments add-on

In order to query by Taxonomy under Custom Query Arguments use the following format:

{"taxonomy_name" : "tag_name"}

In our case this will be: {"genre" : "comedy"}

IMPORTANT: After this step make sure to “Publish” your Swift Template so it can generate all the variables needed at the next step.

Moving forward we get to the Swift Templates tab where we start to build the actual Taxonomy Single and Archive Templates. In the right side you will see a list of all the available variables for the selected Custom Post Type Movies.

WordPress Creation Kit - Swift Templates - Single Template

We can start building the Comedy Taxonomy Single Template by selecting the variables we need and adding them to the left side editor.

Note: To properly display the WYSIWYG Editor Field used in the Swift Template, add the variable with 3 curly braces (3 mustaches): {{{ custom_field }}}

We want the listing to contain the Movie Title, Description, Genre, Movie Information and All Movie Actors information. And we can also add a little bit of HTML for a basic layout.

<img src="{{movieinfo_poster}}" class="alignright"/>
<strong>Release date</strong>: {{movieinfo_release-date}}<br/>
<strong>Director</strong>: {{movieinfo_director}}<br/>
<strong>Genre</strong>: <br/>
    <li><img src="{{picture}}" class="alignleft" />
    Name: {{name}}<br/ >
    Role: {{role}}

Make sure to mark the checkbox below the Single Template Editor to use it on all posts for the selected Custom Post Type.

WordPress Creation Kit - Swift Templates - Single Template Comedy Structure

Then Update the newly created Swift Template and you’re all set.

Now if you have a look at the Movie Single Page it will display all the attached Custom Fields and Taxonomy information.

WordPress Creation Kit - Swift Templates - Front End Single Comedy Movie

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket