到目前为止,我执行了以下任务来添加theme-dependent CSS/JS文件;我添加到主题的functions.php
这段代码,然后创建了相关的CSS和JS文件:
function my_theme_enqueue_styles() {
wp_enqueue_style( \'parent-style\', get_parent_theme_file_uri() . \'style.css\' );
}
add_action( \'my_theme_enqueue_styles\', \'wp_enqueue_styles\' );
function my_theme_enqueue_assets() {
wp_enqueue_script( \'behavior\', get_theme_file_uri( \'behavior.js\' ), array(), null, true );
}
add_action( \'wp_enqueue_scripts\', \'my_theme_enqueue_assets\' );
但是如果我想让我的CSS和JStheme-independent? 比如说,我想有几行CSS和JS,可以在所有主题中使用。在WordPress中有这样做的方法吗outside the WordPress User Interface?