我需要类似的翻译工具&;方向目的。
通过为每个帖子定义$方向,\'ltr\'或\'rtl\'。。。使用this simple plugin ...我通过向插件添加以下操作来编辑插件。php文件:
add_action(\'wp\', function($locale){
// get post meta from database, which is generated by the plugin
global $post;
$direction = get_post_meta($post->ID, \'os_custom_box_for_rtl\', true);
// set locale language based on post meta
$locale = ($direction == \'rtl\')? \'ar\':\'en_US\'; // ...or use your own locale codes
// if not admin area, do switch! it will work for frontend only per specific page/post
is_admin() or switch_to_locale( $locale );
});