I would like to dynamically import different template parts (hardcoded sidebars or navigations) into my layout based on a taxonomy assigned to the post. For instance, this "standard" code works as intended:
<?php get_template_part( 'nav', 'term' ); ?>
and is outputting the (previously hardcoded) file "nav-term.php" where I want it to be. My question: How can I dynamically pick the term of that custom taxonomy assigned to my post and output it as a value of my function? Something like so: "( 'nav', 'dynamically_picked_term' )".
N.b. I'm selecting taxonomy terms by ACF plugin. Also the ACF API could be used.
Thank you in advance for any advice!