Answers for "taxonomy with post acf"

PHP
1

taxonomy acf

<?php 
$term = get_field('taxonomy_field_name');
if( $term ): ?>
    <h2><?php echo esc_html( $term->name ); ?></h2>
    <p><?php echo esc_html( $term->description ); ?></p>
<?php endif; ?>
Posted by: Guest on July-10-2020
0

wp get acf category in post

<?php 
  $categories= get_the_category();
  if (!empty($categories)) {
    $term_id = $categories[0]->term_id;
    $image = get_field('category-image-field', 'term_'.$term_id);
    // what you do from here depends on what the field is returning
  }
?>
Posted by: Guest on December-20-2021

Browse Popular Code Answers by Language