WPML Query_posts
У меня есть клиент, у которого есть проблема с WPML и query_posts();
Сообщения отображаются на языке по умолчанию, но не в испанской версии сайта.
Это показывает запасной результат h2.
<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,
к массиву, но это не исправило решение.
Спасибо за любую помощь!
1 ответ
Ответ заключался в создании переведенных версий постов. Я не знал, что это еще не было сделано, мой первый раз с использованием WPML. Плагин добавляет языковую категорию к запрашиваемым сообщениям.