feat: add post revision control (#344)

pull/369/head
Seaton Jiang 2021-03-11 08:27:44 +08:00
parent c3250ee916
commit fff7aa9e91
No known key found for this signature in database
GPG Key ID: C1086BAE716FF138
2 changed files with 15 additions and 5 deletions

View File

@ -3,7 +3,7 @@
* 核心函数 * 核心函数
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2021.03.10 * @version 2021.03.11
*/ */
if (kratos_option('g_cdn', false)) { if (kratos_option('g_cdn', false)) {
@ -91,13 +91,15 @@ function theme_autoload()
} }
add_action('wp_enqueue_scripts', 'theme_autoload'); add_action('wp_enqueue_scripts', 'theme_autoload');
// Admin Bar // 前台管理员导航
if (! kratos_option('g_adminbar', true)) { if (! kratos_option('g_adminbar', true)) {
add_filter('show_admin_bar', '__return_false'); add_filter('show_admin_bar', '__return_false');
} }
// 移除自动保存、修订版本 // 移除自动保存、修订版本
remove_action('post_updated', 'wp_save_post_revision'); if (kratos_option('g_post_revision', true)) {
remove_action('post_updated', 'wp_save_post_revision');
}
// 添加友情链接 // 添加友情链接
add_filter('pre_option_link_manager_enabled', '__return_true'); add_filter('pre_option_link_manager_enabled', '__return_true');

View File

@ -3,7 +3,7 @@
* 主题选项 * 主题选项
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2021.03.10 * @version 2021.03.11
*/ */
function getrobots() function getrobots()
@ -229,7 +229,7 @@ function kratos_options()
$options[] = array( $options[] = array(
'name' => __('Gravatar 加速', 'kratos'), 'name' => __('Gravatar 加速', 'kratos'),
'desc' => __('开启 Gravatar 头像加速', 'kratos'), 'desc' => __('开启 Gravatar 头像加速', 'kratos'),
'std' => '0', 'std' => '1',
'id' => 'g_gravatar', 'id' => 'g_gravatar',
'type' => 'checkbox', 'type' => 'checkbox',
); );
@ -482,6 +482,14 @@ function kratos_options()
'type' => 'checkbox', 'type' => 'checkbox',
); );
$options[] = array(
'name' => __('附加功能', 'kratos'),
'desc' => __('关闭文章自动保存、修订版本功能', 'kratos'),
'id' => 'g_post_revision',
'type' => 'checkbox',
'std' => '1',
);
$options[] = array( $options[] = array(
'name' => __('文章打赏', 'kratos'), 'name' => __('文章打赏', 'kratos'),
'desc' => __('开启文章页面打赏功能', 'kratos'), 'desc' => __('开启文章页面打赏功能', 'kratos'),