P
P
partyzanx2018-06-14 19:16:26
WordPress
partyzanx, 2018-06-14 19:16:26

How to show in polylang part of the html code in one language and another part of the code in another?

Hello. Tell me please. I'm looking on the Internet, I can't find it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Mamenko, 2018-06-15
@partyzanx

The logic of the task is very simple:
1. Determine the current language
2. Check the match of the current language
3. Depending on the match, display the code
For example, if the site has English and Russian:

$en_lang = 'en';
$ru_lang = 'ru';
$curr_lang = pll_current_language();

if ( $curr_lang == $en_lang ) {
     // для англ версии
} elseif ( $curr_lang == $ru_lang ) {
    // для русской
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question