I have made 2 contact forms in WP, contactform and contactform_fr.
If the language is changed to French, i would like to show contactform_fr.
I found this is the footer.php
<div class="col-xs-12 col-sm-8">
<h2><?php the_field("title", 34); ?></h2>
<?php echo do_shortcode("[contact-form-7 id='89' title='Contact']"); ?>
</div>
<div class="col-xs-12 col-sm-3 col-sm-offset-1">
<?php dynamic_sidebar("footer-widget-1"); ?>
</div>
Can i change it here?
Yes you can change it there, in case you use WPML plugin to translate your website:
<?php if(ICL_LANGUAGE_CODE=='en'); ?>
<?php echo do_shortcode("[contact-form-7 id='89' title='Contact']"); ?>
<?php elseif(ICL_LANGUAGE_CODE=='fr'); ?>
<?php echo do_shortcode("[contact-form-7 id='something' title='Something']"); ?>
<?php endif; ?>
You can read more about it in WPML coding APi https://wpml.org/documentation/support/wpml-coding-api/
In case you use qtranslate plugin you can use:
<? if(get_language_code()=='EN'): ?>
<?php echo do_shortcode("[contact-form-7 id='89' title='Contact']"); ?>
<? elseif(get_language_code()=='FR'): ?>
<?php echo do_shortcode("[contact-form-7 id='something' title='Something']"); ?>
<?php endif; ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.