This seems very straight forward, but I can't get it to work even after going through the documentation (and a number of questions in this site) multiple times.
I have a custom post type called comic
with a taxonomy field (type radio button) called book
. The book
taxonomy has a text field called book_title
. I'm trying to display the value of book_title
in single-comic.php
.
This is what I've done so far:
<?php
$term = get_field('book');
if( $term ): ?>
<h1><?php echo $term->book_title; ?></h1>
<?php endif; ?>
This results in an empty h1
element, which suggests that $term
returns true
. Also, echoing $term
returns 9
which I believe is the number of fields (default and custom) associated with book
taxonomy. This means that I'm getting the correct object. I'm just unable to use it to display the values of its fields.