Blog

您正在浏览 editor 的归档。

如何在 BuddyPress 中启用 WP 原生的 theme editor

11月 17, 2009

由于 BuddyPress 是基于 WPMU,因此后台和 WPMU 一样隐藏并禁用了 WP 原生的 theme editor,如果想在 BuddyPress 里使用 WP 原生的 theme editor,只要遵循以下步骤 (基于 BuddyPress 1.1.2/WPMU 2.8.5.2):

  1. 注释掉 /wp-admin/includes/mu.php 第556行:
    1
    unset( $submenu['themes.php'][10] ); // always remove the themes editor

    替换成

    1
    //unset( $submenu['themes.php'][10] ); // always remove the themes editor
  2. 仍然在这个文件中,第1128行:
    1
    if ( strpos( $_SERVER['PHP_SELF'], $page ) ) {

    替换成

    1
    if ( strpos( $_SERVER['PHP_SELF'], $page ) && !is_site_admin() ) {

这样可以确保只有在站点管理员 (Site Admin) 的后台界面才显示并激活原生的 theme editor。

另外,如果同时注释掉第555行:

  • 1
    unset( $submenu['plugins.php'][15] ); // always remove the plugin editor

    替换成

    1
    //unset( $submenu['plugins.php'][15] ); // always remove the plugin editor

那么可以同时激活原生的 plugin editor, ooops ;-)

参考: http://mu.wordpress.org/forums/topic/13318

Update: 以上代码位置在 BuddyPress 1.1.2/WPMU 2.8.6 没有变动。