如何使用 qTranslate-x 获取所选语言的最新 post?

How do I get the latest post in the selected language with qTranslate-x?

"Hide Content which is not available for the selected language." 的设置=>语言中的设置未选中。这是整个站点的首选状态,但对于某些 post,我只想显示所选语言的最新 post。 (因此没有默认行为:"Sorry, this entry is only available in French.")。

到目前为止我有这段代码,它以它所用的语言显示最新的 post,但我只想获得用所选语言编写的 post。

while ( have_posts() ) : the_post();
$mypost = get_post(get_the_ID()); 
$content = qtranxf_use('en', $mypost->post_content,false); 
echo "$content";
endwhile;

所以最后我使用这种方法来查询特定语言:

$mypost = array('post_type' => 'posts', 'paged' => get_query_var('paged'), 's' => '[:en]',  'posts_per_page' => 7);

它为关键字添加了额外的 query:[:en] 或您想要的任何语言。而且你可以循环遍历它:

$loop = new WP_Query($mypost);
while ($loop->have_posts()) : $loop->the_post(); ?>

    <article>
        <?php the_content(); ?>
    </article>
<?php
endwhile;