ナビゲーションをスキップする
4

If you are running a multilingual website, you can use WPML to easily translate your custom post types, custom fields, and taxonomies.

What are Custom Post Types

Posts and Pages are examples of standard post types built into WordPress. A custom post type is similar to these, but it can be named anything you want. This makes it a great option for organizing and structuring your website.

For example, a blog about fitness and health might have the custom post type “Gyms” for their posts about local fitness centers. This means that standard post types won’t be mixed with any “Gyms” posts.

Listing page for a custom post type “Gyms” showing some custom posts

In our example above, the custom post types for this site are “Gyms”, “Personal Trainers”, and “Sessions”.

Some themes also come with their own custom post types, which are visible from the WordPress dashboard as a separate menu item.

Adding custom information to post types

To further customize your site’s structure you can add custom fields and taxonomies to your post types.

WordPress provides some built-in, standard fields like the title, main content, and date of publishing. However, you can create your own custom fields for any type of information you want.

For example, we can add important information to our “Gym” posts, like “Address”, “Image Gallery”, “Rating”, and more.

“Gym” post with custom fields in the editor

“Gym” post with custom fields information on the front-end

Taxonomies help group and categorize content in WordPress. You already know the built-in taxonomies for standard posts – Categories and Tags. However, you can create custom taxonomies and categorize your (custom) post types in any way you want.

For example, our Gyms post type could have a custom taxonomy called “Gym Types” and you can then add categories like “Weight Lifting”, “Yoga”, “Aerobic”, and so on.

Selecting a “Gym Type” taxonomy for a specific gym post

Displaying the “Gym Type” on the front-end

When to use Custom Post Types

A site benefits from using custom post types for various reasons, such as:

  • Some content does not need to have a chronological hierarchy.
  • You need to separate different types of posts.
  • Certain types of content need to display in a specific way on the front-end.

Additionally, using custom post types makes it easier for users to browse and sort through posts on a website. For example, you can sort the custom post type “recipes” with custom fields such as “Max Cook time” or “Levels of difficulty”. This makes it easier for users who are looking for a quick and easy recipe.

Searching through different “recipes”

How to create a Custom Post Type

The most common and practical way to create custom post types is by using a plugin. Alternatively, you could create a child theme and add custom PHP code to do this.

The plugin Toolset is fully compatible with WPML (as we made it). It allows you to easily create your own custom post types, custom fields, and custom taxonomies. Toolset also provides you with a way to then display all that custom content on the front-end. You can create your custom post types from the WordPress admin and simply design them by using the standard WordPress Gutenberg editor.

Check out this short page (video included) about creating custom post types with Toolset.

To learn all about custom post types, custom fields, and taxonomies, check out the free Toolset training course about custom types.

How to translate Custom Post Types

After you have made your custom post types, you need to set them as translatable in WPML.

Go to WPML → Settings and scroll to the Post Types Translation section. Choose one of the two Translatable options for the custom post types you want to translate.

Setting the Custom Post Types “Gyms” and “Sessions” to be Translatable

After your custom post types have been set to one of the two Translatable options, the posts belonging to them appear on the Translation Dashboard and you can translate them manually or send it for translation to others.

Translating a Post belonging to a Custom Post Type

To translate a post from our Custom Post Type “Gyms”, we need to follow the steps below.

  1. First, we go to WPML → Translation Management to access the Translation Dashboard.
  2. Here we adjust the filters under Select items for translation to find the post you need to translate. In our case, we select “Gym” from the first dropdown and click on Filter.
  3. Next, we tick the box next to the post we want to translate.
  4. On the lower part of the screen, we click on Translate for the language we are using.
  5. We click the button Add selected content to translation basket to finish.
Sending the post “Salvation Fitness” for translation

Once these steps are completed, we can switch tabs on the top of the screen to get to the Translation Basket.

Sending a post for translation in the Translation Basket tab

On this page, we carefully check all of the translation jobs and the total number of words that need translating. After doing this we can press the button Send all items for translation.

Because we’ll translate ourselves, we click on WPML → “Translations”.

This takes us to the Translations queue where we can begin translating our post. This page is important because it lets us see if there are any translation jobs available. If you have local translators set up to translate your site content for you, this is what they see when they pick up the jobs you send them. 

To translate our post “Salvation Fitness”, we click on Take and translate

Translating the post in the Translations queue

In our example, we use the Automatic Translation Editor (ATE) to automatically translate our content and edit translations if needed.

Using the Advanced Translation Editor

When we are done translating, we click the button Complete

And that’s it, we just translated one of the posts belonging to our custom post type.

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.

Book a call with Agnes