I have some javascript in my footer that are only being dropped in if they pass a php check. Due to some page optimisations I would like to enqueue these scripts. I tried to enqueue the php scripts like so:
function add_base_scripts() {
wp_enqueue_script(get_template_directory_uri() . '/base-scripts.php');
}
add_action('wp_footer', 'add_base_scripts');
But I'm not seeing any of the scripts from base-scripts.php being put into the page. It's definately the correct directory which makes me think its a problem with the scripts being in a php file. I haven't found anything online as to if you can use a php file or not. Can someone confirm/debunk this?