I have the following in a child theme’s functions.php file:
<?php
function theme_child_add_scripts() {
wp_register_script(
'script',
get_stylesheet_directory_uri() . '/js/script.js',
array( 'jquery' ),
null,
false
);
wp_enqueue_script( 'script' )
}
add_action('wp_enqueue_scripts', 'theme_child_add_scripts');
script.js isn’t included on the page and there’s no network request going out to get it. What could be going wrong? It’s unclear whether the child theme’s functions.php file is even being executed.
edit: It seems that the functions.php file is not being executed at all, because I put a die(‘foo’) at the top of the file and the page loaded normally. Why would this be happening?
In styles.css:
/*
Theme Name: Theme-child
Template: Theme
*/