How to Show taxonomies terms custom field value using ACF plugin

1k views Asked by At

I have used Advance Custom Field (ACF) wordpress plugin to add custom filed on Woocommerce -> Product -> Categories form.

Right now i can't able to print that field value on categories page.

Please see this screen shot to know field slug name and other details -> http://nimb.ws/BsSiJO and help me to show that field value on categories page.

Thanks, Ketan.

1

There are 1 answers

1
Bilal Hussain On

Display a field

<p><?php the_field('field_name', $term); ?></p>

Retrieve a field

<?php

$variable = get_field('field_name', 'product-cat_23');

// do something with $variable

?>

Finding the term related to the current post

<?php

// load all 'category' terms for the post
$terms = get_the_terms( get_the_ID(), 'category');


// we will use the first term to load ACF data from
if( !empty($terms) ) {

    $term = array_pop($terms);

    $custom_field = get_field('category_image', $term );

    // do something with $custom_field
}

?>