I have a theme which support RTL. RTL direction semi work with WPML plugin, but when I add ?rtl=1 to URL it work fully. I mean it switch direction in the correct way.

How I can switch direction without add ?rtl=1 to each URL?

  • what is it rtl=1? never heard of it. Theme should automatically pick the correct direction and if yours don't then you should contact its author – Mark Kaplun Nov 8 '15 at 19:22

Looking at the source, there is no programmatic way to accomplish that. There is only one location where $_GET['rtl'] is referenced and its value is used directly (i.e., it is not used to set the value of another variable used in the plugin). The function you would want to modify if you want the same effect without passing the rtl parameter is function _show_post_content() in inc/translation-management/translation-management.class.php. Specifically this block of code looks to be the only place affected by the parameter:

if ( @intval( $_GET[ 'rtl' ] ) ) {
    $rtl = ' dir="rtl"';
} else {
   $rtl = '';
echo '<html' . $rtl . '>';

You could just remove the if/else statement all together and change the echo to echo '<html dir="rtl">' for a quick "hacky" fix if desired.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.