Hello,
I’ve created a custom Post Type called Events and a custom taxonomy called Speaker Names. Each time I add a new event I will assign a speaker name to the event. I’m using ACF for event details and to assign additional info (Speaker Title, Headshot, Bio, etc.) to each speaker.
The idea is to create an event and use ACF to select a Speaker (taxonomy) and it will show the custom fields (title, bio, headshot) based on that selection.
Everything displays properly on the taxonomy archive pages (example.com/speakers/jon-doe) but I can’t get it to show on any other pages (example.com/category/events). Both pages are pulling the same code so I’m not sure what the difference is. I’m not seeing any errors… the data just isn’t showing. Do I need to do something else to get the data to show on other pages?
I’m using the following rules for each Field Group.
(EventDetails) – Post Type is equal to Events
(SpeakerFields) – Taxonomy is equal to Speaker Name.
I’m using the following code to call the fields.
$term = get_queried_object();
$title= get_field(‘speaker_title’);
$headshot= get_field(‘speaker_headshot’, $term);
$bio= get_field(‘speaker_bio’, $term);
<div class=”title”><h3><?php echo $title; ?></h3></div>
<div class=”headshot”>“></div>
<div class=”bio”><h3><?php echo $bio; ?></h3></div>