Need some more detail on using do_shortcode
-
I recently found this answer from a post three months ago.
“basically what you need is the correct ID for your form..
So you need to search your translation using the primary language post ID, to do this you need to make use of the Polylang functions.$form_id = 252; //assuming this is your default language form ID
$default_lang = pll_default_language(‘slug’);
$current_lang = pll_current_language(‘slug); //the current language your page is being viewed as
if($current_lang != $default_lang){
$form_id = pll_get_post($form_id, $current_lang);
if(empty($form_id)){ //if a translation does not exists
$form_id = 252; //show the default form
}
}
//display your form
echo do_shortcode(‘[contact-form-7 id=”’.$form_id.’″]’);”Im having the same problem but i cant fully understand what is it that i have to do.
could you please be more specific?
do i have to put the code above, where i previusly had my “echo do_shorcode ” ?
- The topic ‘Need some more detail on using do_shortcode’ is closed to new replies.