In this tutorial, we show how to create templates for custom posts types in multilingual sites. We’ll design the template visually and use WPML to translate it.
Today, WordPress’s default editor is the Block Editor (aka Gutenberg). It’s a visual editor that’s become a reliable and mature tool. We’ll use it to design our templates, together with the Toolset plugins.
Setting things up
To create templates for custom posts, you only need the following two plugins:
Toolset Types
Toolset Blocks
To get these plugins, you will need a Toolset subscription. However, you can test and try all Toolset plugins for free on the Discover WP site. It allows you to create your own sandbox site with a number of prebuilt site templates to choose from and install in one click.
To translate your templates and your site in general, you also need the following WPML plugins:
WPML core plugin
WPML Translation Management
WPML String Translation
Creating a template for custom posts
Here are the steps to create your template:
Go to the Toolset → Dashboard page. It lists all post types in your site along with all custom fields, taxonomies, and templates you have for each post type.
Look in the row of the post type you want to design a template for and click the Create Content Template button.
You are taken to the WordPress Block Editor for your template. Here, you use Toolset blocks to insert different fields. This can be a WordPress field like a post body, any custom field, or a taxonomy. After inserting any Toolset block, enable the Dynamic Source option and select the field you want to display.
And that’s it, now insert any number of fields you need and tweak how they appear on the page. Each Toolset block has sections for adjusting the styling, typography, and more.
Of course, you can do much more. For example, you can arrange contents in columns, use containers, display parts of the template conditionally, display a list of related posts, create responsive designs, and more.
Here’s a whole video tutorial on creating a template for displaying custom posts.
You can find more information and related tutorials on the Toolset’s lesson on creating single-post templates.
Translating the templates on multilingual sites
OK, now that you know how to create templates, let’s see how to translate them for your multilingual sites. Toolset comes from the same team behind WPML so the integration is seamless.
Go to the WPML → Translation Management page.
Use the dropdown in the top search section, select Content Template, and click Filter.
Select the template you want to send for translation.
Select the languages you want to translate the template into.
Click Add selected content to the translation basket.
Finally, click the Translation Basket tab, select the translator you want to use, and click Send all items for translation.
If you want to translate the items yourself, simply go to the WPML → Translations page and click the Take and translate button next to the translation job you want to do.
Build advanced dynamic sites with Toolset
This tutorial shows only a tiny bit of what you can build with Toolset:
Design custom lists of posts
Build advanced custom searches
Display posts on a map
Create front-end forms for submitting posts
Design custom archive pages
Create custom WooCommerce sites
Connect content through advanced post relationships
Toolset starts at only $69 for a complete package for one site. If you’re interested in Toolset, there’s a 30% discount waiting for you on our coupons page.
How can we make WPML better for you?
Share your thoughts and comments about our plugin, documentation, or videos by booking a Zoom call with Agnes, our Client Advocate. Your feedback matters and helps us improve.