我有一个客户,他对WPML和query_posts()有问题;
这些帖子以默认语言显示,但不以网站的西班牙语版本显示。
它显示了回退h2。
The site
The Spanish site


<ul class="news">
<?php
query_posts(array(
'post_type' => post,
'posts_per_page' =>2,
'order' => DESC,
'suppress_filters' => 0,
));
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<div class="ico-holder"><img src="<?php bloginfo('template_directory'); ?>/images/ico-pen.png" width="25" height="27" alt=""></div>
<div class="text">
<strong class="title"><a href="<?php the_permalink(); ?>"><?php the_title()?></a></strong>
<p><?php echo strip_shortcodes(wp_trim_words( get_the_content(), 10 )); ?> </p>
<time class="date-time" datetime="<?php the_time(get_option('date_format')); ?>"><?php the_time(get_option('date_format')); ?></time>
</div>
</li>
<?php endwhile; ?>
<?php else : ?>
<h2>
<?php _e('Nothing Found','text_domain'); ?>
</h2>
<?php endif; ?>
</ul>我尝试将'suppress_filters' => 0,添加到数组中,但这并没有解决问题。
感谢您的帮助!
发布于 2016-06-28 05:01:24
答案是创建帖子的翻译版本。我不知道它还没有完成,这是我第一次使用WPML。该插件将语言类别添加到查询的帖子中。
https://stackoverflow.com/questions/38058638
复制相似问题