Title: hardcode language choice in the theme
Last modified: August 20, 2016

---

# hardcode language choice in the theme

 *  [iceq](https://wordpress.org/support/users/iceq/)
 * (@iceq)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/)
 * Hi. I installed a theme that has an RTL (Right to Left) stylesheet to use on 
   my RTL, Arabic blog. The documentation of the theme said the RTL style will be
   automatically loaded in an RTL blog. My blog is RTL, Arabic.But the RTL style
   didn’t load, instead, the default, LTR one.
    I made sure I have “”`define ('WPLANG','
   ar_AR');`“” in the wp-config file. But still didn’t help.
 * I installed the plugin WordPress Languages, and using it, I changed the front
   end language to Arabic, and then the RTL style was loaded fine.
    But I do not
   want to use a plugin, I want to hardcode that into my WordPress, How can I do
   it?
 * This info might help:
 * when the WordPress Languages plugin **isn’t active**, and the **RTL of the theme
   isn’t loaded**, the index’s source shows this,
 *     ```
       <!DOCTYPE html>
       <html lang="ar-AR" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
       <head>
       <meta charset="UTF-8" />
       ```
   
 * when the WordPress Languages plugin **IS active**, and I chose **English as the
   front-end** language, (so the **RTL of the theme isn’t loaded**), the index’s
   source shows this,
 *     ```
       <!DOCTYPE html>
       <html lang="en-US" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
       <head>
       <meta charset="UTF-8" />
       ```
   
 * when the WordPress Languages plugin **IS> active</strong, and I chose ****ARABIC**
   as the front-end language, (so the **RTL of the theme IS loaded**), the index’s
   source shows this:
 *     ```
       <!DOCTYPE html>
       <html dir="rtl" lang="ar" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
       <head>
       <meta charset="UTF-8" />
       ```
   

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [wpmnger](https://wordpress.org/support/users/wpmnger/)
 * (@wpmnger)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481270)
 * Which theme are you using and how are they generating the html?
 * do you have:
    `<html <?php language_attributes(); ?>>` in the header.php?
 * If you just want to
 * > hardcode that into my WordPress
 * Then you can edit the header.php file in the theme and just write the desired
   html output.
 * Generating the output dynamically allows for more options of course and multilingual
   sites.
 * Could you please give some more specific details…
 *  Thread Starter [iceq](https://wordpress.org/support/users/iceq/)
 * (@iceq)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481306)
 * Thank you wpmnger, sorry for late response, it seems WordPress.org’s email notification
   service is not working.
 * In my theme’s header there’s this:
 *     ```
       <html <?php language_attributes(); ?>>
       <head>
       <meta charset="<?php bloginfo( 'charset' ); ?>" />
       ```
   
 * So how should I modify it to make my blog look like an Arabic blog?
 * BTW, are you sure it’s in the theme, not in the blog?
 * Basically, I want to hardcode what that plugin did, into the theme or the WP 
   installation, in order to avoid using the plugin.
    How ?
 *  [wpmnger](https://wordpress.org/support/users/wpmnger/)
 * (@wpmnger)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481307)
 * > I want to hardcode what that plugin did
 * Then in header.php just type
    `<html <?php language_attributes(); ?> dir="rtl"
   >`
 * But it would be wiser to let WordPress determine these settings for you. If your
   language is not automatically generating the dir attribute as rtl you might want
   to post a question specifically for your localization team
    [http://ar.wordpress.org/](http://ar.wordpress.org/)
 * I don’t know Arabic so I can’t help you any further however,
    try `define('WPLANG','
   ar');` instead of `define ('WPLANG', 'ar_AR');`
 * That is what is in the config-sample for WordPress in Arabic
 *  Thread Starter [iceq](https://wordpress.org/support/users/iceq/)
 * (@iceq)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481310)
 * Thank you wpmnger
    I added `<html <?php language_attributes(); ?> dir="rtl">`
   to the header, and replaced define `('WPLANG', 'ar_AR');` with `define('WPLANG','
   ar');` , but still the theme doesn’t load the rtl style.
 * please note: if you know what that plugin above does, I am sure you’ll be able
   to know the trick. That plugin allows me to select the language of the dashboard,
   and the front end, and it works perfectly. Currently, I configured the plugin
   to set my blog’s interface (the public pages) to Arabic, and the dashboard to
   English.
    So what is it that the plugin does, that implements this setting?
 *  [wpmnger](https://wordpress.org/support/users/wpmnger/)
 * (@wpmnger)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481313)
 * Sorry iceq, but without knowing which theme you are using or which plugin – I
   really can’t help.
 * If you want to “hard code” you can always add a link to your rtl stylesheet:
   `
   <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/rtl.
   css;>" type="text/css" />`
 * This is assuming your stylesheet is named rtl.css and is located in your theme
   directory.
 *  [wpmnger](https://wordpress.org/support/users/wpmnger/)
 * (@wpmnger)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481314)
 * `<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/rtl.
   css" type="text/css" />`
 * Sorry, typo
 *  Thread Starter [iceq](https://wordpress.org/support/users/iceq/)
 * (@iceq)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481315)
 * No need to be sorry, you are helping me alot 🙂
    I mentioned the plugin’s name
   before, it is “WordPress Language” found [here](http://wpml.org/documentation/related-projects/wordpress-language/)
 * The theme is a premium theme called Sahifa
 * Can you please tell me where to put that “link” ?
    Thank you
 *  [wpmnger](https://wordpress.org/support/users/wpmnger/)
 * (@wpmnger)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481316)
 * you can place it directly in header.php in between the <head> tags
 * OR
 * you can create a function in your functions.php that will add it
    [http://codex.wordpress.org/Function_Reference/wp_enqueue_style](http://codex.wordpress.org/Function_Reference/wp_enqueue_style)
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481317)
 * I’m sorry but as you are using a commercial theme, you need to seek support from
   the theme’s developer/vendor. We do not support commercial themes here.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘hardcode language choice in the theme’ is closed to new replies.

## Tags

 * [language](https://wordpress.org/support/topic-tag/language/)
 * [RTL](https://wordpress.org/support/topic-tag/rtl/)

 * 9 replies
 * 3 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/hardcode-language-choice-in-the-theme/#post-3481317)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
