0

I'm using WP Multilang v2.3.0 plugin to support translation of the content to English.

Currently I have it configured for two languages, my primary and English. While I'm on the main site (index.php) I'm showing excerpts of last 4 posts (simplified code):

<?php $posts = get_posts(array(
    'posts_per_page'    => 4,
  'post_type'           => 'post'
    ));
-- here some code
<?php foreach( $posts as $post ):setup_postdata( $post ); ?>
-- here some code
<p><?php the_excerpt(); ?></p>

My post from WP Admin Panel looks like that in English:

This is the excerpt in English.

<!--more-->

This is the content in English

And the same post in my primary language:

This is the excerpt in my primary languagee

<!--more-->

This is the content in my primary language

The issue

Now the problem is that even if I'm on the main site (index.php) with language as english (mysite.com/en/) WP still shows the excerpt of the post in my primary language, not in english, despite my chosen language for the site. To be precise, I've observed that the_category() and the_permalink() and get_the_date() respects the current language setting.

I've tried using the_content() as well, but same thing happens. For some reason it just won't catch the language setting. However, when I go to the post permalink (site) and single.php takes in place, everything is fine with regards to the language chosen.

What I ask for

Is there a way to show post excerpt on the main site with respect to the language I'm currently on?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.