Skip Navigation

[Resolved] Display a label if a post in a loop does not have a translation(WPML) available

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 3 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1983099
2021-03-11_22-15-56.png

Tell us what you are trying to do?

I'm using toolset to list a series events with livestream embeds. The website has been translated with WPML but many of these events will be English only. There are probably only a few that will be available in both English and French. The loop has be adjusted using a function snippet to surpress filters so the English meetings will be listed even if the user is viewing the site in French.

I would like to add a simple label to meetings that are only available in English so French users don't get confused when they see English titles on a French page.

Is there any documentation that you are following?

None

Is there a similar example that we can see?

Not that I'm aware of.

What is the link to your site?

hidden link

#1983287

Hello,

There isn't such kind of built-in feature, it needs custom codes, for example, you can create a custom shortcode with a PHP function:
https://developer.wordpress.org/reference/functions/add_shortcode/
In above PHP function, check if current post is translated or not:
https://wpml.org/wpml-hook/wpml_element_has_translations/
And output different results.

Use above custom shortcode as condition of [wpv-conditional] shortcode to output your label:
https://toolset.com/course-lesson/using-toolset-conditional-block/#checking-for-shortcodes-values