I want to add external JavaScript link in the custom post template. I am adding the below function in the child theme. But the external link is not loaded in the custom post theme. Am I doing something wrong ? TIA
function temp_enqueue_scripts() {
if ( 'custom-template.php' == get_page_template() ) {
wp_enqueue_script('script0', 'lib/myscript.js', array('jquery'));
}
}
add_action( 'wp_enqueue_scripts', 'temp_enqueue_scripts' );
is_page_template()
and make sure the script URL is correct.