it-swarm.cn

设置部分从右到左的管理界面

我正在构建一个自定义主题WordPress实例,需要在公共面上使用阿拉伯语,在管理网站上使用英语,但在编辑字段中使用RTL(右侧刷新)。我的主题照顾公众的面孔,但我需要帮助主题管理方面。

我知道有一种方法可以使博客全部使用阿拉伯语,但我希望所有管理员标签和类别名称都保持英语。我只希望所有管理文本输入字段都成为RTL。哦,也是插件生成的文本输入字段,但我怀疑这更难。

我知道这是一个CSS更改,但不知道从哪里开始这种界面的部分自定义。

3
Alexandre Rafalovitch

好问题。我能用一个小插件制作整个管理员RTL(我把它写成 一个必须使用的插件 ,但应该在标准中工作插件文件夹也是如此)。这是一个非常简单的版本,请看这里的输出:

RTL Admin v0.1 screen output

这是插件代码(我的文件名:rtl-admin.php):

<?php
/**
 * RTL Admin Wordpress Plugin
 *
 * @-wp-header Plugin Name: RTL Admin
 * @-wp-header Author: hakre
 * @-wp-header Version: 0.1
 * @-wp-header Author URI: http://hakre.wordpress.com/
 *
 * @author hakre <hakre.wordpress.com>
 * 
 * Copyright 2010  hakre <hakre.wordpress.com>
 *  
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *  
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

class RTLAdminPlugin {
 private static $instance;
 public static function bootstrap() {
  defined('WP_ADMIN') && WP_ADMIN 
  && (self::$instance === null) 
  && (self::$instance = new RTLAdminPlugin());
 }
 public function __construct() {
  $r = add_filter('admin_init', array($this, 'admin_init'));
 }
 public function admin_init() {
  $GLOBALS['wp_locale']->text_direction = rtl;
 }
} // class

RTLAdminPlugin::bootstrap();

return;
#EOF;
2
hakre