qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
554 stars 105 forks source link

Meta tag ACF #1201

Closed webmaxo closed 2 years ago

webmaxo commented 2 years ago

Hello, I've run into a problem with the acf. Created the Text fields, tied them to the Product Category. wrote meta tags in 2 languages. and in the head I try to put it out like this

<?php
$queried_object = get_queried_object();
?>

<title><?php the_field('title_cat', $queried_object);?></title>

as a result, I get [:ua]test 1[:ru]test 2[:]

spleen1981 commented 2 years ago

Hi, you should translate your content first, so code above should be something like:

<title><?php echo qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage(get_field('title_cat', $queried_object));?></title>
webmaxo commented 2 years ago

Thank you very much. Problem solved