Adding support for language written in a Right-To-Left (RTL) direction is easy.
There are two ways to do that:
Example:
wp_enqueue_style( 'themeslug-style', get_stylesheet_uri() ); wp_style_add_data( 'themeslug-style', 'rtl', 'replace' );
direction: rtl; unicode-bidi: embed;
text-align: left; float: right; clear: left;
becomes
text-align: right; float: left; clear: right;
Some images are clearly suited only for one direction (arrows for example). Create a horizontally flipped version of those images.
.commentslink{
background:url("./images/comments.gif") no-repeat 0 3px;
padding-left:15px;
margin: 2px 4px 0px 12px;
left: 10px;
}
becomes
.commentslink{
background:url("./images/comments-rtl.gif") no-repeat 100% 3px;
padding-left:0;
padding-right:15px;
margin: 2px 12px 0px 4px;
left:auto;
right:10px;
}
For buttons that have hidden text using text-indent, you need to change its value from negative to positive:
.image-button{
text-indent:-99999px;
}
becomes
.image-button{
text-indent:99999px;
}
The RTL Tester plugin allows you to easily switch the text direction of the site: http://wordpress.org/extend/plugins/rtl-tester/
P.S. This plugin allows to VIEW ONLY RTL. i.e. How would your site look like when its Text Direction is changed & this change isn't viewed by the viewers, (unless the whole CSS is changed).
Example:
<input type="text" class="email-address1 email" id="email-address1" /> <input type="text" class="tel-number1 tel" id="tel-number1" /> <input type="text" class="zip1 zip" id="zip1" /> <input type="text" class="url-address1 url" id="url-address1" />
Using class:
/* These fields should be LTR in a RTL language direction */
.email-address1,
.email,
.tel-number1,
.tel,
.zip1,
.url-address1,
.url,
...
{
direction: ltr;
}
WordPress default visual text editor doesn't support writing in RTL languages like Hebrew, Persian and Arabic. Therefore, if you're willing to write a post in one of those languages, you should either :