feat: add static resource acceleration (jsDelivr)

pull/620/head
Seaton Jiang 2023-03-30 10:11:03 +08:00
parent 433bde35c5
commit 4a4e8e2765
No known key found for this signature in database
GPG Key ID: B79682F6FE8D30E3
2 changed files with 16 additions and 3 deletions

View File

@ -4,10 +4,16 @@
* 核心函数
* @author Seaton Jiang <hi@seatonjiang.com>
* @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()

View File

@ -4,7 +4,7 @@
* 主题选项
* @author Seaton Jiang <hi@seatonjiang.com>
* @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',