feat: add child theme support (#385)

pull/388/head
Seaton Jiang 2021-06-25 10:11:57 +08:00
parent b18299bf56
commit 6883a9ef67
No known key found for this signature in database
GPG Key ID: 0E05070D261ACFEA
11 changed files with 2509 additions and 2518 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

View File

@ -1,2 +0,0 @@
;
// 请在第三行开始编写代码

View File

@ -1,2 +0,0 @@
<?php
// 请在第三行开始编写代码

View File

@ -1,3 +0,0 @@
# 目录说明
此目录支持添加一些自定义代码,所有文件是加载到最后的,不用担心冲突问题,建议使用 git 控制此目录,当主题升级之后可以方便的配置自定义内容。

View File

@ -3,10 +3,10 @@
* 模板函数
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2020.06.05
* @version 2020.06.25
*/
define('THEME_VERSION', wp_get_theme()->get('Version'));
define('THEME_VERSION', '3.3.2');
// 主题配置
require get_template_directory() . '/inc/options-framework/autoload.php';
@ -39,7 +39,4 @@ require get_template_directory() . '/inc/theme-dogecloud.php';
require get_template_directory() . '/inc/theme-volcengine.php';
// SMTP 配置
require get_template_directory() . '/inc/theme-smtp.php';
// 自定义函数
require get_template_directory() . '/custom/custom.php';
require get_template_directory() . '/inc/theme-smtp.php';

View File

@ -116,7 +116,7 @@ class Options_Framework_Admin {
if ( $this->options_screen != $hook )
return;
wp_enqueue_style( 'optionsframework', get_stylesheet_directory_uri() . '/inc/options-framework/css/optionsframework.css', array(), Options_Framework::VERSION );
wp_enqueue_style( 'optionsframework', 'https://cdn.jsdelivr.net/gh/vtrois/kratos@' . THEME_VERSION . '/inc/options-framework/css/optionsframework.css', array(), Options_Framework::VERSION );
wp_enqueue_style( 'wp-color-picker' );
}
@ -133,7 +133,7 @@ class Options_Framework_Admin {
// Enqueue custom option panel JS
wp_enqueue_script(
'options-custom',
get_stylesheet_directory_uri() . '/inc/options-framework/js/options-custom.js',
'https://cdn.jsdelivr.net/gh/vtrois/kratos@' . THEME_VERSION . '/inc/options-framework/js/options-custom.js',
array( 'jquery','wp-color-picker' ),
Options_Framework::VERSION
);

View File

@ -112,7 +112,7 @@ class Options_Framework_Media_Uploader {
if ( function_exists( 'wp_enqueue_media' ) )
wp_enqueue_media();
wp_register_script( 'of-media-uploader', get_stylesheet_directory_uri() . '/inc/options-framework/js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION );
wp_register_script( 'of-media-uploader', 'https://cdn.jsdelivr.net/gh/vtrois/kratos@' . THEME_VERSION . '/inc/options-framework/js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION );
wp_enqueue_script( 'of-media-uploader' );
wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
'upload' => __( '上传', 'kratos' ),

View File

@ -3,7 +3,7 @@
* 核心函数
* @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License
* @version 2021.06.05
* @version 2021.06.25
*/
if (kratos_option('g_cdn', false)) {
@ -45,7 +45,11 @@ function theme_autoload()
if (kratos_option('g_fontawesome', false)) {
wp_enqueue_style('fontawesome', ASSET_PATH . '/assets/css/fontawesome.min.css', array(), '5.15.2');
}
wp_enqueue_style('kratos', ASSET_PATH . '/assets/css/kratos.min.css', array(), THEME_VERSION);
if (kratos_option('g_cdn', false) && !is_child_theme()) {
wp_enqueue_style('kratos', 'https://cdn.jsdelivr.net/gh/vtrois/kratos@' . THEME_VERSION . '/style.css' , array(), THEME_VERSION);
} else {
wp_enqueue_style('kratos', get_stylesheet_uri(), array(), THEME_VERSION);
}
if (kratos_option('g_adminbar', true)) {
$admin_bar_css = "
@media screen and (min-width: 782px) {
@ -67,7 +71,6 @@ function theme_autoload()
wp_add_inline_style('kratos', $admin_bar_css);
}
}
wp_enqueue_style('custom', get_template_directory_uri() . '/custom/custom.css', array(), THEME_VERSION);
// js
wp_deregister_script('jquery');
wp_enqueue_script('jquery', ASSET_PATH . '/assets/js/jquery.min.js', array(), '3.4.1', false);
@ -76,7 +79,6 @@ function theme_autoload()
wp_enqueue_script('sticky', ASSET_PATH . '/assets/js/theia-sticky-sidebar.min.js', array(), '1.5.0', true);
wp_enqueue_script('dplayer', ASSET_PATH . '/assets/js/DPlayer.min.js', array(), THEME_VERSION, true);
wp_enqueue_script('kratos', ASSET_PATH . '/assets/js/kratos.min.js', array(), THEME_VERSION, true);
wp_enqueue_script('custom', get_template_directory_uri() . '/custom/custom.js', array(), THEME_VERSION, true);
$data = array(
'site' => home_url(),

2497
style.css

File diff suppressed because it is too large Load Diff