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

Create Taxonomy Archive 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 Archive 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 Archive Template

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

When listing all Comedy Movies we would also want to display certain Custom Fields information attached to the Movies Custom Post Type.

Our Taxonomy Archive Template will therefor contain a list of Comedy Movies with the following information:

  1. Movie Title
  2. Poster
  3. Release Date
  4. Director
  5. Actors Name

Create Taxonomy Archive Template with Swift Templates

Swift Templates allows you to build a Taxonomy Archive 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 Archive and Single 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 Archive Template. 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 - Archive Template

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

We want the listing to contain the Movie Title, Poster, Release Date, Director and Actors Names. And we can also add a little bit of HTML for a basic layout.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{#posts}}
<article id="post-{{post_id}}">
	<header class="entry-header">
    	<a href="{{post_permalink}}"><h2 class="entry-title">{{post_title}}</h2></a>
    </header>  
    <div class="entry-content">
    	<img src="{{movieinfo_poster}}" class="alignright"/>
    	<div class="alignleft">
  			<strong>Release date</strong>: {{movieinfo_release-date}}<br/>
  			<strong>Director</strong>: {{movieinfo_director}}
  			<h4>Actors:</h4>
  			<ul>
  		            {{#movieactors}}
    			    <li>{{name}}</li>
  			    {{/movieactors}}
  			</ul>
    	</div>
    </div>
</article> <br/>
{{/posts}}
 
{{{pagination}}}

* NoticeBelow the Archive Template, you’ll notice a similar box for the Single Template creation which we covered in the Create Taxonomy Single Templates page.

All that’s left to do now is to Update the new Swift Template. This will generate a shortcode which can be inserted in a page that you want to contain your Comedy Movies listing.

So let’s create a new page called “Comedy” and add the [swift-template name=”comedy-movies”] shortcode.

WordPress Creation Kit - Swift Templates - Comedy

Once you view the page you’ll see the Comedy Movies listing with all the attached Custom Fields information you wanted.

WordPress Creation Kit - Swift Templates - Front End Comedy List

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