The WPML plugin offers translations to the blog posts in the languages set, but it does not offer an arranged way of displaying the blog posts. Currently i have 3 languages for my website EN, DE and FR. I need to display all the blog posts based on the current language so if i am on the EN version of the website i get first the EN blog posts, then DE and then FR. Same rule applies for the other languages if i am on the FR version of the blog page i get FR blog posts first then other languages.
Currently i have the following
$args = array(
'post_type' => 'post',
'suppress_filters' => true,
'posts_per_page' => -1,
'name' => $slug,
);
$query = new WP_Query($args);
The 'suppress_filters' => true,
displays all the blog posts in all the languages, but not arranged.
The next is the standard looping in wordpress through the blog posts
<?php if($query->have_posts()) :?>
<?php while($query->have_posts()) : $query->the_post(); ?>
<a href="<?php echo get_permalink(); ?>">
<img src="<?php echo get_the_post_thumbnail_url(); ?>" alt=""?>
</a>
<?php echo get_the_date(); ?>
<p><?php the_excerpt(); ?></p>
<?php endwhile;
endif; ?>
I can also get the currently selected language from wpml with <?php echo ICL_LANGUAGE_CODE ?>
as well as the translated blog language with <?php echo wpml_get_language_information($post->ID)['language_code'] ?>
Does anybody have any idea how i can custom order the blog posts ? Thanks