This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 16 replies, has 2 voices.

Last updated by Radu 3 months, 1 week ago.

Assigned support staff: Radu.

Author Posts
July 1, 2019 at 9:00 am

armandP-2

My widget Recents posts (Last posts) does not filter my posts by languages. I have 2 different Recents Posts widget, one is in Spanish, another one in Catalan, and it does not work.

hidden link

I expected to see Last Posts in Spanish when I have Spanish language selected, and the same for Catalan:

Instead, to see all posts in all languages:

July 1, 2019 at 9:38 am #4117183

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Armand,

Thank you for reaching out the WPML support!

As I can see, the plugin that helps with the recent posts is called Medicare. This plugin might not be compatible with WPML but you can try to do this change. Please go to /wp-content/plugins/medicare/ folder, open the medicare.php file, replace line 3935:

$recent_posts = wp_get_recent_posts( array( 'numberposts' => $number, 'post_status' => 'publish' ) );

with this one:

$recent_posts = wp_get_recent_posts( array( 'numberposts' => $number, 'post_status' => 'publish', 'suppress_filters' => true ) );

and check again the widgets. Can you tell me if each language displays its own posts, please?

Thanks,
Radu

July 1, 2019 at 9:54 am #4117553

armandP-2

Hi Radu,
I tried to do what you told me, but it doesn't work, and with this new code in medicare.php, on blog page shows me all posts on all languages. It does not filter by language, and my widget continue with the same problem.
What Can I do ?

Thanks for your contact.

July 1, 2019 at 10:32 am #4117837

armandP-2

Excuseme,
I can not see the Content folder in wordpress, and the web does not show. Is there any problem or are you making a test ?

July 1, 2019 at 11:22 am #4118357

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Armand,

I didn't do any change on your website. I just had a look at the widgets, that's all.
I checked your website and I could see that there's an error message that the child theme has some issues. Also, I don't have access to the FTP section to make any changes to the content folder (/wp-content/) so this issue was definitely caused by something else. Did you do any other change on your website? Having the whole /wp-content/ folder disappear is pretty strange.

Thanks,
Radu

July 1, 2019 at 1:19 pm #4119277

armandP-2

Hi,
Do not worry, I am restoring it. The unique change I did was to put the code you told me, nothing else. and at least the web was working, I don't know what happened.
Just give me some minutes and you can check how to fix widget problem ok ..

Thanks

July 1, 2019 at 2:19 pm #4120127

armandP-2

Hi, the web is restored. now you can check please about mi widget Recents posts.
Thanks

July 1, 2019 at 2:23 pm #4120137

armandP-2

There is another thing I forgot to say:
When people leave a message on post, The buttons and some text is in English, I tried to find the words on WPML translation, and it does not show me any word. please, if you can check this for me, I appreciate it.

Thanks

July 2, 2019 at 12:12 pm #4126645

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Armand,

Let's take care of the recent posts widget first and then we'll have a look at the post messages too.

Now that your website is back to normal, can you do the change that I suggested here https://wpml.org/forums/topic/my-widget-recents-posts-shows-me-all-posts-in-all-languages/#post-4117183 and tell me if each language displays different posts in the widget, please? That little part that I added to the code is used by WPML to "understand" that only posts from the current language need to be displayed.

Thanks,
Radu

July 2, 2019 at 1:33 pm #4127427

armandP-2

Hey Radu,
I did the changes you asked me, but my widget continues the same, it does not filter posts by language, it shows me posts in Spanish and Catalan. I clear all cookies from my browser, and it doesn't work.

Thanks

July 3, 2019 at 5:29 am #4131867

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Armand,

Can you change the 'suppress_filters' value from true to false, please? This way should work (I copied the wrong line of code in my previous message, with the value set to true). Please tell me if the posts in each language are different now.

Thanks,
Radu

July 3, 2019 at 7:20 am #4132575

armandP-2

Hi Radu,
I put it as false, but it does not work-
Please, just check this post for example and you will see the same post on widget of the right side in Catalan as well with the title " ACTES NATURALS IMPOSSIBLES DE FER AMB ELS ULLS OBERTS ". hidden link
Thanks

July 4, 2019 at 7:04 am #4140591

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Armand,

Thank you for doing this new change. That's exactly what made this work. There's only one more thing to change: please go to Dashboard → WPML → Settings → Post Types Translation, and change the Posts option from the middle column to the first one. Once you saved the changes, just simply go back to the widgets on each language and different posts will be displayed. You might need to clear the cache too.

Right now, if a translation is not available for a post, the original one will be displayed instead. By doing the change I mentioned, this won't happen again and the posts from each language will display separately.

Thanks,
Radu

July 4, 2019 at 7:48 am #4140869

armandP-2

Hi Radu,
Perfect, now it works. Thanks.
Please, now, I just need to translate Message form in the post, I can´t, it does not show me the words I look for inside the wpm > Translation Strings. no string shows. Could you help me with this please ?

Thanks for your help.

July 4, 2019 at 11:18 am #4142691

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey Armand,

I'm glad to hear that the posts widget works the way you want now!

Can you send me a link to a post where I can see this message form, please? I just want to make sure that I'm checking the right part.

Thanks,
Radu

The topic ‘[Closed] My widget Recents Posts shows me all posts in all languages’ is closed to new replies.