Elementor Integration

Elementor Integration

TranslatePress is fully compatible with Elementor, so if your website is built using Elementor, you can achieve the same functionality for widgets and sections directly from Elementor』s interface.
Restrict by Language
To use this option click on a widget or section and then go to the Advanced tab, where you』ll find the Restrict by Language option. Set the first option, Restrict element to language, to Yes and select the language in which you』d like to show the selected element.

The second option, Enable translation, is used when the restricted content is written in the default language, either directly by you or by an element like the Posts element. Keep in mind that the content has to be translated for it to be properly displayed in the restricted language.
Exclude from Language
Through Elementor an extra option is provided, Exclude from Language, through which you can make an element to be shown in all languages, except the one(s) that you selected.

Oxygen Builder Integration

Oxygen Builder Integration

TransatePress is also compatible with Oxygen Builder, that』s why if your website is built on Oxygen, you can display certain elements in specific languages directly from the Oxygen』s interface.
How to Show / Hide Oxygen Builder Elements Based on Language
Go to the Oxygen editor interface and open the element that you want to restrict based on a language. Then, click the Condition Settings icon and then Set Conditions:

Search in the Choose Condition drop-down, and select Dynamic Data:

Then, choose PHP Function Return Value:

Set the Function Name equal to get_locale and then click Insert:

Set the value equal to the language code for the language that you want to target (this code is available by going to Settings -> TranslatePress and looking in the Code column of the All Languages section):

If you want to target another language, you can just repeat the same process to add another condition.

Also, if needed, rules to exclude entire pieces of content from translation can be used.

Conditional Shortcode Based on Language

Conditional Shortcode Based on Language

Things like emails sent to users by different plugins cannot be translated using the visual translation interface because they do not appear in the front-end.
For these other types of content you can use the conditinal shortcode to display content based on language:
[trp_language language="en_US"] English content only [/trp_language]
This can be done also with PHP:

Another use case of the conditional shortcode is for translating images, basically displaying different images for different languages.
[trp_language language="en_US"]

[/trp_language]
[trp_language language="fr_FR"]

[/trp_language]

However, this can now be easily achieved directly from the front-end using the built in image translation functionality.
It is also possible to use the conditional shortcode to display Gutenberg blocks only on the desired language.
To do this, you will have to wrap the Gutenberg block between two shortcode blocks. The first shortcode block will contain the start of our conditional shortcode ([trp_language language=」en_US」]) and the second block will contain the end of our conditional shortcode ([/trp_language]).

The result can be seen in the following image. The first page is the default English version and the second page is the Spanish version of the same page.

WPBakery Integration

WPBakery Integration

TranslatePress is fully compatible with the WPBakery page builder. If your website structure is built using WPBakery, you can easily display certain elements on a specific language or exclude it from certain languages.
After the integrations with Elementor and Oxygen Builder, WPBakery was not allowed to be missing from this list.
How to show/hide WPBakery elements based on language
In order to display or hide an element based on language TranslatePress gives you 2 options you can use:
Restrict by Language
To use this option click on the element that you want to restrict, and then go to the TranslatePress tab, where you』ll find the Restrict element to language option. Set the option to Yes and select the language in which you』d like to show the selected element.

Exclude from Language
Through WPBakery an extra option is available, Exclude from Language, through which you can display an element in all languages, except the one(s)* that you selected.

*To select multiple languages just use the Ctrl key while you selecting the languages with the cursor.