Getting the right form using do_shortcode();
-
Hello!
I’m just looking for a solution for WordPress polylang and CF7 outputing a form in the template via do_shortcode(); because there is a lot of pages to insert. Other wise I’d insert the shortcode to each page in each language.
So I found the pinned topic. But it seems this plugin is useless (I’m really sorry for my opinion, author). Maybe you tell why the plugin is better than the next construction:
<?php $languages = pll_the_languages(array('raw' => 1)); foreach ($languages as $language) { ?> <?php if ($language['slug'] == "en") { ?> <?php echo do_shortcode("[contact-form-7 id=\"1\"]"); ?> <?php }else if($language['slug'] == "ru"){ ?> <?php echo do_shortcode("[contact-form-7 id=\"2\"]"); ?> <?php } ?> <?php } ?>
I hope you’ll understand what I mean.
Thanks.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Getting the right form using do_shortcode();’ is closed to new replies.