S
S
sasha7612020-02-08 20:09:24
WordPress
sasha761, 2020-02-08 20:09:24

How to display the ACF field from the product category on the main page?

Good evening, in general, I created an ACF field that is displayed in the taxonomy equals category (this is a regular text area) and also created a Record (Relationship) field for the main page in which I display products. And actually, here is the output of goods ( the output of goods works fine )

<?php	if( $products ): ?>
              <div class="row grid">
                <?php foreach( $products as $post): ?>
                  <?php setup_postdata($post); ?>

                  <?php 
                  global $product;
                  // $cate = get_queried_object();			
$terms = get_the_terms( $post->ID, 'product_cat' );
$docs = get_field('extra_class', $terms);
  // print_r($docs);
                  ?>
                  <div class="col-lg-3 col-md-3 u-col grid-item all">
                    ........					
                  </div>
                <?php endforeach; ?>
                <?php wp_reset_postdata();  ?>													
              </div>
            <?php endif; ?>

But I can't get this field that I display in the category.
What do i do ? Tell me please ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question