How to write RTL support in your theme of WordPress? The very most important thing is that when you make a WordPress theme then you have to make two types of language support which are LTR(left to right) and RTL(right to left). Most languages supported LTR which English or max languages and RTL supported by (Arabic, Hebrew, Farsi, Urdu, and others).
define ('WPLANG', 'ar');
Using this plugin. This plugin is easy to use because all options are visible on the WordPress top admin bar. You can just click and enable this feature.
Go to the WordPress dashboard then Settings->General->Site-language. Select the language of Arabic. It will enable RTL supported language.
NOTE: Please apply anyone step then it will work perfectly.
We suppose the directory name CSS and in file name theme.css. When we support the RTL then the file name will be theme-rtl.css.
wp_enqueue_style('theme-style', get_parent_theme_file_uri('/css/theme.css')); wp_style_add_data( 'theme-style', 'rtl', 'replace' );
if ( is_rtl() ) { wp_enqueue_script('theme-rtl', get_parent_theme_file_uri('/theme-assets/js/theme-rtl.js'), array(‘jQuery’), '', TRUE); }else{ wp_enqueue_script('theme', get_parent_theme_file_uri('/theme-assets/js/theme.js'), array(‘jQuery’), '', TRUE); }
If you want to write your theme fully RTL supported please knock us. How to write RTL support in your theme properly?