I have registered some styles and scripts that should be loaded if a template part is loaded in a template file. For ex:
in home.php
<?php get_template_part( 'template-parts/external_links'); ?>
(this template-part is loaded across different template files) therefore, I want to enqueue (a previously registered file in functions.php)
Using template files for example I use:
if(is_page_template('admin.php')){
wp_enqueue_script( 'unicorn-admin');
}
Is there a way to enqueue a file when get_template_part( ‘template-parts/external_links’); is used?