H
H
hooli-gun2021-10-17 12:12:08
WordPress
hooli-gun, 2021-10-17 12:12:08

How to display different forms in different languages?

How to bring it out correctly?

<?php
    $locale = get_locale();
    if($locale == 'ru_RU') {
        $contact_form = 'echo do_shortcode( '[contact-form-7 id="420" title="Оформити заявку"]' );';
    } else if($locale == 'uk'){
        $contact_form = 'echo do_shortcode( '[contact-form-7 id="419" title="Оформить заявку"]' );';
    } else {
        $contact_form = 'echo do_shortcode( '[contact-form-7 id="421" title="Make a request"]' );';
    }
?>

<?php $contact_form ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-10-17
@hooli-gun

$locale = get_locale();

if( $locale == 'uk' ) {
  echo do_shortcode( '[contact-form-7 id="420" title="Оформити заявку"]' );
} elseif( $locale == 'ru_RU' ) {
  echo do_shortcode( '[contact-form-7 id="419" title="Оформить заявку"]' );
} else {
  echo do_shortcode( '[contact-form-7 id="421" title="Make a request"]' );
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question