Answer the question
In order to leave comments, you need to log in
How to output an ACF field in a category loop?
<?php
$args = array("child_of" => $catalog);
$categories = get_categories( $args );
if( $categories ){
foreach( $categories as $cat ){ ?>
<div class="text_category"><?php the_field("intro_text"); ?></div>
<?php }} ?>
Answer the question
In order to leave comments, you need to log in
It was also necessary to display categories with images that are set using AFC.
To display the field of a specific taxonomy or term, you need to get the id of the current category and add the value like this:
<?php
$term_id = $cat->term_id;
the_field('intro_text', 'term_' . $term_id );
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question