• 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)
  • 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

    (@iceq)

    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 ?

    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/

    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

    (@iceq)

    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?

    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.

    <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/rtl.css" type="text/css" />

    Sorry, typo

    Thread Starter iceq

    (@iceq)

    No need to be sorry, you are helping me alot 🙂
    I mentioned the plugin’s name before, it is “WordPress Language” found here

    The theme is a premium theme called Sahifa

    Can you please tell me where to put that “link” ?
    Thank you

    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

    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.