diff --git a/inc/theme-article.php b/inc/theme-article.php index 3c7dec0..9029786 100644 --- a/inc/theme-article.php +++ b/inc/theme-article.php @@ -93,11 +93,11 @@ function get_post_views($echo = 1) } // 文章列表简介内容 -function excerpt_length($length) +function custom_excerpt_length($length) { - return 260; + return kratos_option('g_excerpt_length', '260'); } -add_filter('excerpt_length', 'excerpt_length'); +add_filter('excerpt_length', 'custom_excerpt_length'); // 开启特色图 add_theme_support("post-thumbnails"); diff --git a/inc/theme-options.php b/inc/theme-options.php index 76ba0a1..e9842a5 100644 --- a/inc/theme-options.php +++ b/inc/theme-options.php @@ -176,6 +176,13 @@ CSF::createSection($prefix, array( 'subtitle' => __('启用/禁用 Gutenberg 编辑器', 'kratos'), 'default' => false, ), + array( + 'id' => 'g_excerpt_length', + 'type' => 'text', + 'title' => __('文章简介缩略', 'kratos'), + 'subtitle' => __('文章简介显示的字符数量', 'kratos'), + 'default' => '260', + ), array( 'id' => 'g_renameother_fieldset', 'type' => 'fieldset',