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 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.