Archived topic
RTL Mode not working
13 replies · Started by Atef on April 6, 2018
Hi,
I have a multilingual website that depend WPML plugin.
It has Arabic (RTL) language in it, however, the test displays LTR.
please check this test post. this is a fresh WP installation:
https://coptic-treasures.bcprafm7-liquidwebsites.com/book/church-history-vol-1-butcher/
The theme has wpenqueue for the rtl.css in the functions.php, as follows:
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
function generatepress_child_enqueue_scripts() {
if ( is_rtl() ) {
wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
}
}
add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
what else I need to do to show the text RTL?
Thanks.
Interesting, it's like is_rtl() isn't returning true.
What's your language set to in the WP settings?
Hi Tom,
the site language is "Arabic" in the WP General Settings Tab. please refer to the screenshot:
http://prntscr.com/j20j7r
thanks,
What happens if you disable WPML?
Hi Tom,
Still No difference. I disabled WPML and all its plugins, but the post still shows LTR.
thanks.
Very strange - can you try adding this CSS?:
body.rtl {
text-align: right;
}
Hi Tom,
if I added this code, the posts will show RTL. so what would be the issue here?
thanks
I'm not sure I understand? Aren't we trying to make the posts show RTL?
Yes we are.
But I am asking why does the posts not show RTL without this custom code?
is it:
- compatibility issue in the theme code, or
- Conflict in the latest WP update, or
- Do I need to copy the rtl.css from the main theme to the child theme director, or
- something else...etc?
thanks
That's a good question - I couldn't find the answer within your site.
Lots of people are using RTL languages without this issue, so there needs to be something specific happening on your site.
We'll be digging deeper in the next few days to find the cause.
Hi Tom,
my wordpress installation for this site is hosted on a managed wordpress "service". So I contacted the support team, and they did extensive checks on the installation.
they found out that the GP Premium plugin is the cause, when they deactivated it, the website showed RTL.
Ichecked this myself several times. when i activate the plugin, the text show LTR, when i deactivate it, it shows RTL.
here is a post that shows now rtl, after i deactivated the plugin:
https://coptic-treasures.bcprafm7-liquidwebsites.com/hello-world/
i don't have any custom css in the GP Premium or any custom code.
I can provide you with login details as a proof.
please advise.
thanks.
Very strange - I'll do some digging and will let you know what I find out.
Does the issue happen if you have the parent theme activated?
Hi Tom,
I dug a bit deeper and found that the problem appears when the GP Premium is active because I had the bootstrap code in the wp_head section:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
The reason that I am switching to GeneratePress is that it is compatible with the WP Types plugin suite, which I will be using to build the site. The WP suite depends on Bootstrap, that's why I had to add the code.
Sorry for this confusion, but it was very tricky to find.
So going forward, is the "wp_head" the best way to put this code?
Thanks a lot.
Ah, yes - wp_head is the correct hook for scripts. However, it must be some of the CSS in bootstrap overwriting the default RTL styling.