Adding a category template & create a theme with a plugin

There’s a newly released plugin named Create Block Theme that will make theme building or child theme creation much easier.

I don’t know how that would work. I’ve never made themes or child themes before.

However, I was just experimenting with the Wei theme and having a problem making a category page work. Then I thought, why don’t I combine the two problems and see how theme creation works?

I could add a category template in Wei, then use the Create Block Theme plugin to make the revised version of the theme a new theme. Then, I could install that new theme on another site and see if the revisions are carried over.

1. Create a working category template

Based on my understanding of how templates in FSE works, I just need to add a new category template from the site editor menu.

Add a category template
Add a category template

However, the new template is missing the header and footer, so those are the template parts that I need to add.

Add header & footer template parts
Add header & footer template parts

To render the category content, I have to add the necessary blocks that compose it, such as the Archive Title block and the Query Loop block. At first, the resulted page didn’t discriminate well between the categories I have in the blog, which are Hikes and Travel. It acted like a common index page. (I populated the blog with a dummy content from one of the FSE outreach program’s testing calls). Only after I toggled on the Inherit query from template under the Query Loop block settings did the category page lists the posts for each respective category.

Add category content block
Add category content block

2. Create a block theme by cloning another theme

After successfully creating the category page, I used the Create Block Theme plugin to clone the modified Wei theme, which I intended to install on another site and see if my added category template is carried over there. To do this, I simply selected the ‘Clone Wei’ options and named the new theme ‘Wei-2Go’. ?

Cloning a theme using Create Block Theme plugin
Cloning a theme using Create Block Theme plugin

3. Install the cloned theme

It turns out that the theme creation went very well. After I uploaded the cloned Wei theme, the new site had a category page working out of the box. I’m happy that it is now really possible to create a WordPress theme with no code. ?

The cloned theme block works like a charm
The cloned theme block works like a charm

Leave a Reply

Your email address will not be published. Required fields are marked *