L
L
LastGeneral2021-10-31 13:40:29
WordPress
LastGeneral, 2021-10-31 13:40:29

How to display different contact forms in different languages?

<?php 
    $locale = get_locale();
    if ($locale == 'ru-RU'){
    	$contact-form = '[contact-form-7 id="158" title="Контактная форма"]';
    } 
  else ($locale == 'uk'){
    $contact-form = '[contact-form-7 id="485" title="Контактна форма"]';
  }
?>
<?php echo do_shortcode( '$contact-form' ); ?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-10-31
@LastGeneral

$locale = get_locale();

if ( $locale == 'ru_RU' ) {
  echo do_shortcode( '[contact-form-7 id="158" title="Контактная форма"]' );
} else {
  echo do_shortcode( '[contact-form-7 id="485" title="Контактна форма"]' );
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question