UPDATE: I found an easier way to do the same thing Check it out
This post is an update of previous old post: Supporting right to left writing (for Arabic) in WordPress
In my blog I write in both languages English and Arabic, but I have to switch text direction from the template default English direction “Left to Right” to Arabic “Right to Left”.
One way do to it is to add HTML tags in each Arabic entry.
Another way to do it is to utilize WordPress “Custom Fields” feature, WordPress allows you to add custom fields to any entry, so I add a new custom field to my Arabic entries, the key will be “wp_direction” and the value will be “rtl”.
Then from your favorite template modify:
Change the beginning of the file to look something like this:
* The default template for displaying content
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
$direction = get_post_custom_values('wp_direction');
$style_dir = $direction=='rtl'? ' style="direction:rtl;" ' : '';
<article id="post-< ?php the_ID(); ?>" < ?php post_class(); ?> < ?= $style_dir ?> >
You can also use “$style_dir” value to switch the text direction on all relevant tags.
Note: These step tested with WordPress 3.0+