-
-
Save nikola0203/20838c1a34db448b4fcbaac88280db39 to your computer and use it in GitHub Desktop.
Detect RTL on website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wp_is_rtl( $locale = '' ) { | |
static $rtl_locales = array( | |
'ar' => 'Arabic', | |
'ary' => 'Moroccan Arabic', | |
'azb' => 'South Azerbaijani', | |
'fa_IR' => 'Persian', | |
'haz' => 'Hazaragi', | |
'he_IL' => 'Hebrew', | |
'ps' => 'Pashto', | |
'ug_CN' => 'Uighur', | |
); | |
if ( empty( $locale ) && function_exists( 'is_rtl' ) ) { | |
return is_rtl(); | |
} | |
if ( empty( $locale ) ) { | |
$locale = get_locale(); | |
} | |
return isset( $rtl_locales[$locale] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment