Skip Navigation

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 1 year, 7 months ago.

Assisted by: Mihai Apetrei.

Author Posts
September 16, 2023 at 8:47 am #14406173

mohammedA-177

Hi

i wand to make different font for two languages...

so how i can do this ?

Thanks

September 16, 2023 at 9:44 am #14406371

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi there.

You will need some CSS code to do that.

Example:

html[lang="he-IL"] {
 
font-family: Alef !important;
font-size: 24px !Important;
 
}

The code needs to be added in the Appearance > Customizer > Custom CSS area.

Depending on the language that you will use, you will have to change "he-IL" to the proper language lang code.

Depending on the font that you will use, you will have to change "Alef" to the font's family name.

Kind regards,
Mihai Apetrei

September 16, 2023 at 10:02 am #14406381

mohammedA-177

Thanks for your respond
i have add this code

html[lang="ar"] {
font-family: ibm-plex-sans-arabic !important;
}

but is not work ?

September 16, 2023 at 10:06 am #14406391

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi there.

"html[lang="ar"]" might not be correct, you might have two words instead of just "ar".

Also, the font family name might not be correct.

What is the domain URL?

September 16, 2023 at 10:17 am #14406449

mohammedA-177

hidden link

font name correct

September 16, 2023 at 11:04 am #14406557

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

If you put it like this:

html[lang="ar"] body {
font-family: ibm-plex-sans-arabic !important;
}

I can see changes in the areas mentioned in the screenshots I am attaching below if I'm using the code I shared above but probably your theme or the way the current fonts have been implemented are overwriting what we are trying to do, so you would need to mention each and every HTML element individually to overwrite that.

This type of request is considered to be custom work and it falls out of the purpose of our Support Policy but I wanted to try to help and give you an example. But that's the best we can do in situations where custom code is needed like the one we are in now.

As I said, in this specific situation, you might need to target each and every element individually: h1, h2, h3 etc.

Something like this:

html[lang="ar"] body h1, html[lang="ar"] body h2{
font-family: ibm-plex-sans-arabic !important;
}

I hope that you will find this information helpful.

Mihai

Screenshot 2023-09-16 at 13.58.30.png
Screenshot 2023-09-16 at 13.58.27.png
September 16, 2023 at 11:19 am #14406617

mohammedA-177

if you see in nav bar nothing change when use css
i you want i can share with you admin details for enter and chack

thanks

September 16, 2023 at 11:41 am #14406647

Mihai Apetrei
WPML Supporter since 03/2018

Languages: English (English )

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

Hi there.

It does change, that's why I shared the screenshot, but is not a big change.

You can see it better if you test it in 2 different tabs on the browser: open one before adding the code, and open another one after adding the code and you will see a difference in "For Sale", "For rent", and the other word at the end which is in Arabic language.

As I mentioned in my last reply above, these are just examples that I wanted to share with you to try to guide you in the correct direction.

This type of request requires custom work (custom CSS) and it falls out of the purpose of our Support Policy, so we can only guide you but that's all we can do.

I have shared the same example with other customers and it worked fine so the fact that it doesn't work here is definitely related to either the font itself or to the way the fonts are added by the current theme and/or with by (at least one) of the active plugins.

Have a lovely rest of the day and I hope that you will find this information helpful.

Mihai