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.

Sun Mon Tue Wed Thu Fri Sat
12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 - -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 0 voices.

Last updated by Noman 3 months, 3 weeks ago.

Assisted by: Noman.

Author Posts
January 19, 2025 at 8:13 am #16610086

andreA-23

Background of the issue:
I am developing a site and want to use a separate font for the Arabic language, which is the second language on my site. I have added CSS to achieve this.

Symptoms:
The CSS I added is not working.

Questions:
How can I apply a separate font for the Arabic language using WPML?

January 19, 2025 at 1:05 pm #16610479

Noman
WPML Supporter since 06/2016

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. If the theme you are using on your site does not allow different theme options in different languages setting, then it might be not possible, but it would be worth to try the following:

1. Try to use the ‘:lang’ selector with language code just before other CSS selectors to use different CSS/fonts for different languages. So in this case you may use this type of CSS to apply different fonts in Arabic language.

:lang(ar) body, :lang(ar) p, :lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) h4, 
:lang(ar) h5, :lang(ar) h6, :lang(ar) a, :lang(ar) span, :lang(ar) strong {
    font-family: Arial !important;
}

You can change Arial to your required font.

Here is doc for more details:
hidden link

2. You may write your CSS style in different CSS files and load each file in that language. To load the correct CSS file, You can use the “wpml_current_language” hook to get the current language code and load that CSS file accordingly. You may include those CSS files in your theme header.php file or similar (it depends on your theme file structure):

<?php
	//Get current language
	$my_current_lang = apply_filters( 'wpml_current_language', NULL );
	
	// If the language is English
 	if( $my_current_lang == 'en' ) {
	//include English Styles or Fonts here
	}
	// if the language is Arabic
	elseif( $my_current_lang == 'ar' ) {
	//include Arabic Styles or Fonts here
	}
?>

Here is a doc for more details:
https://wpml.org/documentation/support/wpml-coding-api/

Thank you

The topic ‘[Closed] I want seprate font for arabic language its 2nd language’ is closed to new replies.