Awesome Accordions website

Multi-language with WPML

How to translate “Custom Post Types”

To translate accordion post type you should use the WPML plugin that allows you to translate all custom post types that come with your themes or plugins.

To set the accordion custom post type, you will need to install and activate WPML’s core plugin (Sitepress multilingual CMS) along with the Translation Management add-on.

    1. Navigate to WPML -> Translation Management and click on the Multilingual Content Setup tab and scroll down to the Custom Posts section.
    2. Set the custom post type Accordion to be translated.
      translate_custom_post types
    3. Click on the Save button.
    4. Navigate to Accordions -> All Accordions. Click on the + icon to add your translation
      add translation
    5. Click on the Copy content from English button.
      copy_from_english
    6. Add your translated text and click on the Publish button

If you are running a multilingual website, you will want to translate your custom post types, custom field type, and custom taxonomies. WPML can translate all these elements efficiently.

Awesome Accordions Shortcode

Awesome accordions come with multi-language support, you can create and translate accordions in your preferred language. Awesome accordions plugin supports WPML translation and you can display accordions in different languages by simply changing the ID parameter in the shortcode.

After creating the accordion a shortcode is generated that you use to publish the accordion in pages and posts. The shortcode has an Id that is equal to the page ID assigned to the specific accordion custom post when it is created:

accordion shortcode

To publish the accordion you should copy the shortcode as shown in the image above and paste it in the page or post where you would like to display the accordion.

Multi-Language Accordion

To publish multi-language accordion you should begin by creating the accordion and translating it to another language.

For example, you can create the accordion in English then translate to Dutch using the WPML plugin. Click on the add sign to add the translated version of the accordion.

translate accordion

After the translation, you have two similar accordions with different page IDs. You can switch between the different translations using the menu on the top as shown below:

switch languages

Publishing Multi-Language Accordions

You should get the page ID of each of the different version of the accordion that has been created and translated and use it in the awesome-accordions shortcode.

Create a new page and add the shortcode replacing the ID with the respective page ID of the accordion you wish to display. As shown below:

shortcode dutch

For the translated accordion you need to include the original shortcode published in the step above and the corresponding shortcode with the ID of the respectively translated accordion as shown below:

wpml translated accordion

How the Shortcode Translation Function works

The post with the EN shortcode is displayed while for the other versions the shortcode functions check if the translated ID example FR-ID exists and if it does the translated version is shown and if not the English version is displayed.