WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
ContactForm 7 & Qtranslate (4 posts)

  1. soia15
    Member
    Posted 3 years ago #

    Hi,

    I have embedded a form in the template with function;

    <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ); ?>

    Now I would like to make this form multi-language. According to qtranslate I need to add their tags <!--:es--><!--:--> or [:es]. I have tried adding it to the php above using 2 different forms and also adding the tags to the actual form shortcode...but neither worked.

    Any idea what I'm doing wrong or if this is possible?

    Has anybody done this before if so how ?

    I would really appreciate the help.

    Thanks

  2. Lime-IMC
    Member
    Posted 3 years ago #

    <?php if(qtrans_getLanguage() == "en") : ?>
    <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ) ?>
    <?php endif ?>
    <?php if(qtrans_getLanguage() == "fr") : ?>
    <?php echo do_shortcode( '[contact-form 2 "Contact form 2"]' ) ?>
    <?php endif ?>
    <?php if(qtrans_getLanguage() == "nl") : ?>
    <?php echo do_shortcode( '[contact-form 3 "Contact form 3"]' ) ?>
    <?php endif ?>

    That is how I solved it for 3 different languages.

  3. josh412
    Member
    Posted 2 years ago #

    Hello,
    I have version 2.4.6 of Contact Form 7 installed and changed line 84 in settings.php. It was
    return (string) $wpcf7_request_uri;
    and now is

    $lang = "&lang=" . qtrans_getLanguage();
    return ((string) $wpcf7_request_uri) . $lang;

    It works fine for me and maybe this can be a hint to somebody else...
    cheers

  4. enricochico
    Member
    Posted 2 years ago #

    Thanks guys!
    It works for me.
    Small comment:
    I used the languagecode from Lime-IMC one on each contactform and not the whole code in the textbox of all the forms, so:

    <?php if(qtrans_getLanguage() == "en") : ?>
    <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ) ?>
    <?php endif ?>

    in the English version, etc..
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic