0

The user shouldn't choose language! I would like to echo French and English out on exact same page... My fields the_field is outside the_content ? How would you do this?

I would like to show specific pages on another page in two or more languages, while the menu and everything is translated in the language chosen.

The code below does the job for the_content, but I'm using ACF with qTranslate. How would I pull the_field from the database, but only in a specific language (e.g. 'fr') and echo it on an English page?

$id=5; 
$post = get_page($id); 
$content = qtrans_use('fr', $post->post_content,false); 
echo $content;

I have made a template and am able to get other pages (ACF) echoed, but want to make a query/echo for only a specific language? So I don't have to edit in more than one place (Backend). Show French on English page...

Something like:

$id=5; 
$post = get_page($id); 
$content = qtrans_use('fr', $post->the_field('somename'),false); 
echo $content;

Maybe I have to filter my fields in the content instead?

  • 1
    Hi Alan, could you provide more details on what you've tried already (and why it didn't work)? – kraftner Jan 19 '15 at 11:18
  • Is "the_field" a custom field? As in, post_meta? – GhostToast Jan 20 '15 at 14:40
  • Hi GhostToast, yes the_field('image') or the_field('txt') advanced custom fields? – Alan Jan 22 '15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.