Wordpress and RTL

房东的猫 提交于 2019-12-01 00:36:21
Andrew

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.

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

Johnny

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!