theme-independent CSS/JS files

So far I did the following task to add a theme-dependent CSS and JS directives – I added to the theme’s functions.php this code, then created the relevant CSS and JS files:

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’ );

But what if I want my CSS and JS to be theme-independent? Say, I want to had a few lines of CSS and JS that will be available in all themes whatsoever.

Is there a way to do so in WordPress outside the WordPress User Interface?

Read more here:: theme-independent CSS/JS files

Leave a Reply

Your email address will not be published. Required fields are marked *