ARTICLE AD BOX
I am trying to add a custom CSS file (style.css) and a JavaScript file (custom-script.js) to my WordPress theme. I want to ensure I’m doing this the "WordPress way" to avoid conflicts with plugins and to manage dependencies (like jQuery) properly.
I initially tried hardcoding the links in header.php, but I've learned that functions.php is the correct place. Here is my current code block:
function my_theme_enqueue_assets() wp_enqueue_style('my-main-style', get_stylesheet_uri()); wp_enqueue_script('my-custom-js', get_template_directory_uri() . '/js/custom-script.js', array('jquery'), '1.0.0', true); } add_action('wp_enqueue_scripts', 'my_theme_enqueue_as sets');