Hello,
I’m using ACF on a post type and one of those fields is a Select field that selects a Custom Taxonomy (Speaker Name). I’m also using Custom Fields for that Taxonomy (Speaker Title, Speaker Bio, Speaker Headshot, etc.). How can I pull the Taxonomy Custom Fields when the Taxonomy is selected in the Post Type.
For instance, if I select the Speaker Name “Jon Smith”, I would like to automatically pull all of Jon Smith’s info.
This works for pulling the Speaker Name
$speakname= get_field('speaker_name');
<p><?php echo $title; ?></p>
This doesn’t work for pulling the Speaker Bio
$bio= get_field('speaker_bio');
<p><?php echo $bio; ?></p>
Any idea how to get this to work?
Thanks in advance!
// get tax field without formatting, returns term if
$speakname= get_field('speaker_name', false, false);
// get field from term
$bio= get_field('speaker_bio', 'term_'.$speakname);
https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/
Hmm, so the code I provided works when I’m viewing that taxonomy archive (i.e. http://www.example.com/speakers/) but when I view a post type archive (i.e. http://www.example.com/category/) it doesn’t work.
I do have the Field Group set to show when that Taxonomy is set to Speakers… so how do I get them to display the values on other category/archive pages?