Wordpress and RTL

2020-03-06 02:51发布

问题:

WordPress is so powerful.. but yet it is so weak with RTL Languages like Arabic and Hebrew... I need to have the Front-End in Arabic and Admin area to stay in English and of course LTR.. If I use the Arabic version of WordPress. Everything including the admin area will be in Arabic and RTL. which will not be suitable at all. In the same time. Visually editing an Arabic post should be in RTL while the HTML view should be LTR..

I can see that MU version on wordpress.com can have admin area in English while the frontend is in Arabic.

How to do that?

回答1:

WordPress's back end can handle Arabic just fine, with both the editor and the database itself. If you want the front end to display in Arabic you'll need to use/develop a theme that uses Arabic.

If your blog is Arabic-only, you can add a CSS class to the div surrounding the post in the blog template file that sets the text-direction to ltr. If you use Arabic and English, you can set an if statement to decide what direction each post needs to be based on a custom field you add to the post from the back end.



回答2:

Try this plugin, http://wordpress.org/extend/plugins/wp-rtl/



回答3:

Use the Arabic WP installation and use this plugin: http://wordpress.org/extend/plugins/admin-locale/ to switch back to the English admin interface.



回答4:

You may try the plugin WP Native Dashboard: http://www.code-styling.de/english/development/wordpress-plugin-wp-native-dashboard-en



回答5:

The general steps to add RTL are:

  • Step 1 - Create the RTL CSS for Your Theme.
    The first step is to create the CSS for displaying RTL languages correctly on your website. There are two methods for doing this. The first is to simply feed your existing stylesheet into a CSS RTL generator. This tool will examine your CSS and attempt to make a copy, but switching all the left and right alignments. This effectively creates a mirrored version of your website.
  • Step 2 - Ensure WordPress ‘Sees’ the RTL Styles.
    If you’re using a CSS generator tool, you’ll now need to enqueue your new style-rtl.css stylesheet so WordPress can load it in at the appropriate time. This is just a matter of adding a snippet to your theme’s functions.php file.
  • Step 3: Test Your RTL Styles in WordPress RTL Tester plugin.
    You have a few options for testing out RTL languages in your WordPress installation. The first is to simply switch WordPress to an RTL language. To do this, go to the Settings > General page in your WordPress dashboard. Then, select the first script language you see in the Language drop-down box

Here is a full guide: https://torquemag.io/2018/03/rtl-support-wordpress/
For a successfully RTL site example, check out this one.



回答6:

I had the same issue. The blog is in Arabic, and the admin back-end is in English.

If you are using Firefox, you can simply overcome this problem by clicking Switch Text Direction from the right-click menu on the TinyMCE.