Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client needed to hide membership options on their website when the current language is set to Chinese, as the 'alipay' payment method does not support 'Membership' features for Chinese customers.
Solution:
We recommended using CSS to hide specific elements based on the language. The correct CSS code to add under Appearances > Customizer > Custom CSS in WordPress is:

html[lang="zh-hans"] .elementor-column.elementor-col-33.elementor-top-column.elementor-element.elementor-element-43c630d7 {<br />    display: none !important;<br />}

This code targets the HTML language attribute for Chinese ('zh-hans') and applies a style to hide the membership elements. Additionally, for translating menus and content, we suggested using the manual translation options provided by WPML. You can find more details on translating menus manually at Translating Menus Manually and using different translation editors at Using Different Translation Editors for Different Pages.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please do not hesitate to open a new support ticket at WPML Support Forum.

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.

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Mihai Apetrei 3 years, 8 months ago.

Assisted by: Mihai Apetrei.

Author Posts
October 16, 2021 at 3:28 pm #9802933

fengP

Our site supports membership. We are trying to add "alipay" as a payment method for Chinese customer. However, the "alipay" company doesn't support "Membership" and requests to remove membership from the website if the current language is "Chinese".

What's the best way to do this? we have menus and some contents for "membership".

Thanks

October 16, 2021 at 9:32 pm #9803529

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi there.

For menus, you could use the "manual translation" option:
https://wpml.org/documentation/getting-started-guide/translating-menus/#option-1-translating-menus-manually

Or you could use CSS to hide those specific buttons, but that's a more custom approach where you might need a front-end developer to help you.

For the page content, you would either need to use the manual translation option (https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/) or, again, hide it with CSS.

I hope that you will find this answer helpful 🙂

Have an amazing rest of the weekend.

Mihai Apetrei

October 18, 2021 at 12:26 am #9806309

fengP

Hi Mihai,

I would like to CSS. Do you happen to know how to specify "if current language is Chinese" in css?

Thanks,
Emma

October 18, 2021 at 9:53 pm #9812899

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi Emma.

Sure, you should be able to target the <html> lang tag like this:

html[lang="zh-hans"] {css code}

Kind regards,
Mihai

October 23, 2021 at 1:12 am #9847365

fengP

Hi Mihai,

I am trying to add the code in "Custom CSS" in wordpress. Will I be able to check the language inside CSS code?

Thanks,
Emma.

October 23, 2021 at 2:17 am #9847761

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi there, Emma.

Adding that code to Appearances > Customizer > Custom CSS is a good place, indeed.

However, I'm not sure that I fully understand your question.

Can you please try to elaborate a bit more so that I can better understand what you are trying to find out?

Thank you! 🙂

Mihai

October 24, 2021 at 12:45 am #9849987

fengP

Hi Mihai,

Thanks for your reply.

I opened hidden link. Under section "Become a member", there are three level of membership. I clicked the block of one level of membership and inspect the source. I got the element: <div class="elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-62ecac0f" data-id="62ecac0f" data-element_type="column">

I tried to hide the above element by adding the following code under Appearances > Customizer > Custom CSS:

html[lang="zh-hans"]
{
.elementor-column.elementor-col-33.elementor-top-column.elementor-element.elementor-element-62ecac0f{
display: none;
}
}

however, the updates didn't take any effect. the membership level is still displayed when the current language is Chinese.

Any idea?

Thanks,
Emma

October 25, 2021 at 11:16 am #9856453

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi Emma.

That is because the CSS is not good.

This is the correct form:

html[lang="zh-hans"] .elementor-column.elementor-col-33.elementor-top-column.elementor-element.elementor-element-43c630d7 {
    display: none !important;
}

Instead of 4 accolades, we have only 2.

That should solve this for you.

Mihai