Support

Account

Home Forums Front-end Issues Qtranslate shorttags in field labels Reply To: Qtranslate shorttags in field labels

  • Hi @Elliot

    Thanks for your reply worked great.
    Here is the code I used for anyone that may need it. This will get the qtranslate tags working in the field labels and field instructions of a front-end form.

    function my_acf_load_field( $field )
    {
        if(!is_admin()){
            $field['label']  =  apply_filters('the_title', $field['label']);
            $field['instructions']   =  apply_filters('the_title', $field['instructions']);
        }
        return $field;
    }
    add_filter('acf/load_field', 'my_acf_load_field');

    I used is_admin()==false to make sure this only applies to the front-end forms. When used across the whole plug-in, the apply_filters functions seems to be called when acf prints the name of the field label in the wp-admin pages. Making the qtranslate tags invisible the first time you save the form and removing them completely if you save again.

    With is_admin() the translations will be visible in the admin pages while editing forms but this is not an issue in my case.

    Thanks again 🙂