feat: add thumbnail control

pull/230/head
Seaton Jiang 2020-03-17 10:24:12 +08:00
parent eea39c2ef3
commit 00660e8755
2 changed files with 25 additions and 4 deletions

View File

@ -3,7 +3,7 @@
* 核心函数
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2020.02.15
* @version 2020.03.17
*/
// 自动跳转主题设置
@ -42,7 +42,7 @@ function theme_autoload()
wp_enqueue_style('bootstrap', $dir . '/assets/css/bootstrap.min.css', array(), '4.4.1');
wp_enqueue_style('kicon', $dir . '/assets/css/iconfont.min.css', array(), THEME_VERSION);
wp_enqueue_style('layer', $dir . '/assets/css/layer.min.css', array(), '3.1.1');
if(kratos_option('g_animate',false)){
if (kratos_option('g_animate', false)) {
wp_enqueue_style('animate', $dir . '/assets/css/animate.min.css', array(), '3.7.2');
}
wp_enqueue_style('kratos', $dir . '/assets/css/kratos.min.css', array(), THEME_VERSION);
@ -167,4 +167,17 @@ $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'https://github.com/Vtrois/Kratos/',
get_template_directory() . '/functions.php',
'Kratos'
);
);
// 禁止生成多种尺寸图片
if (kratos_option('g_removeimgsize', false)) {
function remove_default_images($sizes)
{
unset($sizes['thumbnail']);
unset($sizes['medium']);
unset($sizes['large']);
unset($sizes['medium_large']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'remove_default_images');
}

View File

@ -3,7 +3,7 @@
* 主题选项
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2020.02.26
* @version 2020.03.17
*/
function getrobots()
@ -100,6 +100,14 @@ function kratos_options()
'options' => $cdn_array,
);
$options[] = array(
'name' => __('禁止生成缩略图', 'kratos'),
'desc' => __('是否禁止生成多种尺寸图片资源', 'kratos'),
'id' => 'g_removeimgsize',
'std' => '0',
'type' => 'checkbox',
);
$options[] = array(
'name' => __('Gutenberg 编辑器', 'kratos'),
'desc' => __('开启 Gutenberg 编辑器', 'kratos'),