Wordpress

来自刘东华的维基
跳转至: 导航搜索

Wordpress.

安装配置

暂无

插件

  1. Wiki Embed
  2. Crayon Syntax Highlighter

用法

常见用法

  • 取消“浏览站点时显示工具栏”
# If you would rather remove the toolbar with code, just drop the following snippet into your functions.php file:
add_filter('show_admin_bar', '__return_false’);
# 生成pot文件
php makepot.php wp-theme ../../src/wp-content/themes/my-theme
 
# 生成mo文件,注意:mo文件名必须用本地化语言代码,如简体中文:zh_CN.mo,mo文件位置为load_theme_textdomain等指定的目录
msgfmt -o zh_CN.mo <input>.po
# mo文件位置
/wp-content/languages // for website
/wp-content/themes/[theme]/core/lang // for themes
/wp-content/plugins/[plugin]/?  // for plugins, not sure yet
 
# Where is the tools
svn co http://develop.svn.wordpress.org/trunk/tools/
 
# Merges two Uniforum style .po files together.
msgmerge [OPTION] def.po ref.pot
 
# if 'msgfmt' and 'msgmerge' can not found
yum install gettext
function remove_the_dashboard () {
    if (current_user_can('level_10')) {
        return;
    }else {
        global $menu, $submenu, $user_ID;
        $the_user = new WP_User($user_ID);
        reset($menu); $page = key($menu);
        while ((__('Dashboard') != $menu[$page][0]) && next($menu))
        $page = key($menu);
        if (__('Dashboard') == $menu[$page][0]) unset($menu[$page]);
        reset($menu); $page = key($menu);
        while (!$the_user->has_cap($menu[$page][1]) && next($menu))
        $page = key($menu);
        if (preg_match('#wp-admin/?(index.php)?$#',$_SERVER['REQUEST_URI']) && ('index.php' != $menu[$page][2]))
        wp_redirect(get_option('siteurl') . '/wp-admin/post-new.php');
    }
}
add_action('admin_menu', 'remove_the_dashboard');