0

I'm using the following code to display the content of the post with PostID of 4:

<?php $post_id = 4; $queried_post = get_post($post_id); echo $queried_post->post_content; ?>

However this is code is displaying the content of both languages I have defined with Qtranslate. How can I make it show only the content of the language it is set on.

Thanks!

user1937021
  • 10,151
  • 22
  • 81
  • 143
  • How did you define both languages with qTranslate? You should have shown the example so that answerers could get the idea where you did wrong. – Lenin Oct 19 '20 at 16:37

1 Answers1

0

If I've understood you correctly, you should be able to run the content through the __() or _e() function to have qTranslate extract the content for the current language. So

<?php
$post_id = 4;
$queried_post = get_post($post_id);
_e($queried_post->post_content);
?>

should do the trick

Hobo
  • 7,536
  • 5
  • 40
  • 50