diff --git a/inc/theme-core.php b/inc/theme-core.php index 5049cca..3d1645a 100644 --- a/inc/theme-core.php +++ b/inc/theme-core.php @@ -4,10 +4,16 @@ * 核心函数 * @author Seaton Jiang * @license GPL-3.0 License - * @version 2023.03.28 + * @version 2023.03.30 */ -define('ASSET_PATH', get_template_directory_uri()); +// CDN 资源地址 +if (kratos_option('g_cdn', false)) { + $asset_path = 'https://cdn.jsdelivr.net/gh/seatonjiang/kratos@v' . THEME_VERSION; +} else { + $asset_path = get_template_directory_uri(); +} +define('ASSET_PATH', $asset_path); // 自动跳转主题设置 function init_theme() diff --git a/inc/theme-options.php b/inc/theme-options.php index d35663a..37ed7b7 100644 --- a/inc/theme-options.php +++ b/inc/theme-options.php @@ -4,7 +4,7 @@ * 主题选项 * @author Seaton Jiang * @license GPL-3.0 License - * @version 2023.03.12 + * @version 2023.03.30 */ defined('ABSPATH') || exit; @@ -120,6 +120,13 @@ CSF::createSection($prefix, array( 'subtitle' => __('启用/禁用 Font Awesome Free 字体', 'kratos'), 'default' => false, ), + array( + 'id' => 'g_cdn', + 'type' => 'switcher', + 'title' => __('静态资源加速', 'kratos'), + 'subtitle' => __('启用/禁用静态资源加速(jsDelivr)', 'kratos'), + 'default' => true, + ), array( 'id' => 'g_renameimg', 'type' => 'switcher',