mirror of https://github.com/vtrois/kratos
feat: add child theme support (#385)
parent
b18299bf56
commit
6883a9ef67
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
||||||
;
|
|
||||||
// 请在第三行开始编写代码
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?php
|
|
||||||
// 请在第三行开始编写代码
|
|
|
@ -1,3 +0,0 @@
|
||||||
# 目录说明
|
|
||||||
|
|
||||||
此目录支持添加一些自定义代码,所有文件是加载到最后的,不用担心冲突问题,建议使用 git 控制此目录,当主题升级之后可以方便的配置自定义内容。
|
|
|
@ -3,10 +3,10 @@
|
||||||
* 模板函数
|
* 模板函数
|
||||||
* @author Seaton Jiang <seaton@vtrois.com>
|
* @author Seaton Jiang <seaton@vtrois.com>
|
||||||
* @license MIT License
|
* @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';
|
require get_template_directory() . '/inc/options-framework/autoload.php';
|
||||||
|
@ -40,6 +40,3 @@ require get_template_directory() . '/inc/theme-volcengine.php';
|
||||||
|
|
||||||
// SMTP 配置
|
// SMTP 配置
|
||||||
require get_template_directory() . '/inc/theme-smtp.php';
|
require get_template_directory() . '/inc/theme-smtp.php';
|
||||||
|
|
||||||
// 自定义函数
|
|
||||||
require get_template_directory() . '/custom/custom.php';
|
|
|
@ -116,7 +116,7 @@ class Options_Framework_Admin {
|
||||||
if ( $this->options_screen != $hook )
|
if ( $this->options_screen != $hook )
|
||||||
return;
|
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' );
|
wp_enqueue_style( 'wp-color-picker' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class Options_Framework_Admin {
|
||||||
// Enqueue custom option panel JS
|
// Enqueue custom option panel JS
|
||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'options-custom',
|
'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' ),
|
array( 'jquery','wp-color-picker' ),
|
||||||
Options_Framework::VERSION
|
Options_Framework::VERSION
|
||||||
);
|
);
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Options_Framework_Media_Uploader {
|
||||||
if ( function_exists( 'wp_enqueue_media' ) )
|
if ( function_exists( 'wp_enqueue_media' ) )
|
||||||
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_enqueue_script( 'of-media-uploader' );
|
||||||
wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
|
wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
|
||||||
'upload' => __( '上传', 'kratos' ),
|
'upload' => __( '上传', 'kratos' ),
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* 核心函数
|
* 核心函数
|
||||||
* @author Seaton Jiang <seaton@vtrois.com>
|
* @author Seaton Jiang <seaton@vtrois.com>
|
||||||
* @license MIT License
|
* @license MIT License
|
||||||
* @version 2021.06.05
|
* @version 2021.06.25
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (kratos_option('g_cdn', false)) {
|
if (kratos_option('g_cdn', false)) {
|
||||||
|
@ -45,7 +45,11 @@ function theme_autoload()
|
||||||
if (kratos_option('g_fontawesome', false)) {
|
if (kratos_option('g_fontawesome', false)) {
|
||||||
wp_enqueue_style('fontawesome', ASSET_PATH . '/assets/css/fontawesome.min.css', array(), '5.15.2');
|
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)) {
|
if (kratos_option('g_adminbar', true)) {
|
||||||
$admin_bar_css = "
|
$admin_bar_css = "
|
||||||
@media screen and (min-width: 782px) {
|
@media screen and (min-width: 782px) {
|
||||||
|
@ -67,7 +71,6 @@ function theme_autoload()
|
||||||
wp_add_inline_style('kratos', $admin_bar_css);
|
wp_add_inline_style('kratos', $admin_bar_css);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wp_enqueue_style('custom', get_template_directory_uri() . '/custom/custom.css', array(), THEME_VERSION);
|
|
||||||
// js
|
// js
|
||||||
wp_deregister_script('jquery');
|
wp_deregister_script('jquery');
|
||||||
wp_enqueue_script('jquery', ASSET_PATH . '/assets/js/jquery.min.js', array(), '3.4.1', false);
|
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('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('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('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(
|
$data = array(
|
||||||
'site' => home_url(),
|
'site' => home_url(),
|
||||||
|
|
Loading…
Reference in New Issue