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.

This topic contains 8 replies, has 2 voices.

Last updated by Mihai Apetrei 4 years, 7 months ago.

Assisted by: Mihai Apetrei.

Author Posts
March 23, 2020 at 4:33 pm #5743683

razielh

Hello
I am trying to customize different fonts for different .
i have 6 different languages and each one I like to change font and size.

i try to follow this article but i don't understand exactly what is done:
https://wpml.org/forums/topic/different-fonts-for-different-languages-in-theme-customize-typography/

pleas help me to figure it is out

thanks

March 23, 2020 at 6:00 pm #5744415

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi and thank you for contacting WPML Support!

I will be happy to help you with this.

First of all, thank you very much for your patience and sorry to have you waiting - there is a very full ticket queue at the moment and it takes us a bit more than usual to answer tickets.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of the site files and database before providing us access.

- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box.

The private box looks like this: hidden link

I will be waiting for your response.

Kind regards,
Mihai Apetrei

March 24, 2020 at 10:11 am #5749397

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi.

Here is the custom CSS that you should be able to use for each of the languages that you are using (I will use the "Arial" font for example):

English

html[lang="en-US"] {font-family: Arial !important;}

Hebrew

html[lang="he-IL"] {font-family: Arial !important;}

Russian

html[lang="ru-RU"] {font-family: Arial !important;}

French

html[lang="fr-FR"] {font-family: Arial !important;}

Spanish

html[lang="es-ES"] {font-family: Arial !important;}

Arabic

html[lang="ar"] {font-family: Arial !important;}

Kind regards,
Mihai

March 24, 2020 at 11:33 am #5750309

razielh

Hello Mihai

how do i add the font size to the css code?

March 24, 2020 at 12:27 pm #5750897

razielh

also, I add the code to the custom CSS and it is no working.
you can check why?

March 24, 2020 at 1:33 pm #5751519

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi.

I think the CSS was not working because you copy-pasted everything (including the language names) so when WordPress was reading the CSS code, it would stop right when it was finding a word that made no sense to it.

I thought that you would just copy the codes 🙂 but no worries, now I have created a comment tag so that you can still keep the language names so that you know which language is each CSS line targeting.

I added this into the backend of your site:

/*English*/

html[lang="en-US"] {font-family: Roboto !important;}

/*Hebrew*/

html[lang="he-IL"] {font-family: Assistant !important;}

/*Russian*/

html[lang="ru-RU"] {font-family: Arial !important;}

/*French*/

html[lang="fr-FR"] {font-family: Arial !important;}

/*Spanish*/

html[lang="es-ES"] {font-family: Arial !important;}

/*Arabic*/

html[lang="ar"] {font-family: Arial !important;}

Also, for changing the font size, you can simply add a new line under the existing "font-family" one with the "font-size" property.

Here is an example of the English language code:

html[lang="en-US"] {
font-family: Roboto !important;
font-size: 20px !important;
}

Please let me know if everything works as expected now 🙂

Kind regards,
Mihai

March 24, 2020 at 2:08 pm #5751867

razielh

Lol thanks very much!
just to know if I like to use google font, i need to add some code in the custom CSS field?

March 24, 2020 at 2:23 pm #5751945

razielh

i add the code you did but it's still not working :/
maybe because I use Wp rocket or clarify?

March 24, 2020 at 2:44 pm #5752095

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi.

No, it seems that I forgot to mention an extra element or multiple elements.

Depending on what exactly you want to target, you need to specify that, too.

For example, if you want to target all the paragraphs inside the site, this means that we will need to add into the mix the <p> tag (which is the HTML tag for paragraph).

Here's a complete list of HTML tags: hidden link

Most of the time, the more popular ones are: p, a, h1, h2, h3, h4, h5, h6, span, strong.

Let's say that we would like to target all the English-site paragraphs (see that I added an extra "p" below:

html[lang="en-US"] p{font-family: Roboto !important;font-size: 24px !important;}

If you would like to target more HTML tags, you can use something like this:

html[lang="en-US"] p, html[lang="en-US"] a, html[lang="en-US"] h1{font-family: Roboto !important;font-size: 24px !important;}

Custom CSS is out of the purpose of our Technical Support guidelines here but I wanted to just give you some small tips that you can use 🙂

Also, please use this Google search link so that you can learn how you can use Google fonts into a WordPress site: hidden link..69i57j0l7.3059j0j7&sourceid=chrome&ie=UTF-8

I hope that you will find my answers helpful 🙂

Kind regards,
Mihai