Using the Custom Post Widget Plugin with WPML

The Custom Post Widget plugin allows you to create reusable content blocks and show them in the widget areas and post content of your WordPress website.

The WordPress Multi Language plugin makes it extremely easy to build and maintain multilingual sites. With WPML you can translate pages, posts, custom types, taxonomy, menus and even the theme’s texts. Since I am a big fan of the WMPL plugin I made the Custom Post Widget plugin fully compatible with WPML, which means that it is very easy to translate your content blocks.

In this tutorial I shall explain how to configure the Custom Post Widget plugin to work in conjunction with the WPML plugin and how to add translations to your Content Blocks.

Configuring the Custom Post Widget plugin to add translations using WPML

To get started, you will need the WPML Multilingual CMS plugin. A guide for installing & activating WPML is available on the WPML getting started guide. You can purchase a license for the plugin here.

After installing the Custom Post Widget plugin, you will have to make sure that the content_block custom post type can be translated. To do so, go to Translation Options under the the WordPress admin menu item WPML and choose Translate for the option Content Blocks in the Custom posts section:

screenshot-2

Alternatively, you can check the Make Content Blocks translatable option which should be visible on the edit screen when creating a new Content Block:

screenshot-1

Now you have have configured the WPML plugin to allow the translation of your Content Blocks, you can start adding your translations.

Adding translations for Content Blocks

screenshot-3Adding translations for your Content Blocks is easy. All you have to do is click the + icon when editing your Content Block to add a translation.

When using the language selector on the front-end of your website, the appropriate Content Block translation should be displayed, whether you have added the content block in a widget area or if you are using the shortcode functionality.

Note that the WPML plugin is a tool for managing and displaying translated content. It does not automatically translate your content, you will have to create the translated texts yourself.

Demo site

A demo of the Custom Post Widget plugin running under WPML can be found here:
Default English: http://theme-testing.wpml.org/plugin-custompostwidget/
Dutch: http://theme-testing.wpml.org/plugin-custompostwidget/?lang=nl

On the demo site you can see a translated widget on the left sidebar titled ‘This is a content block in a widget’. When you change the site’s language to Dutch, the widget title and content will change to show the Dutch translation. In the body of the ‘Hello World’ sample post you can find a content block which has been added using a shortcode. The text ‘Test EN’ changes to ‘Test NL’ when using the language selector. Note that this text is not in the actual content of the sample blogpost, but is ‘pulled in’ via the shortcode functionality. This is great for when you want to reuse a particular text to show in multiple posts or pages.

Questions?

As you can see, using the Custom Post Widget plugin is easy. If you have any questions about using the Custom Post Widget plugin in conjuction with WPML, you can ask them in the Custom Post Widget support forum. For questions specifically relating to the WPML plugin, you can use the WPML support forum.