Home › Forums › ACF PRO › get value under woocommerce query › Reply To: get value under woocommerce query
You still need to specify the IF for the term for acf to get the values.
<?php
$args = array(
'number' => $number,
'orderby' => 'title',
'order' => 'ASC',
'hide_empty' => $hide_empty,
'include' => $ids
);
$product_categories = get_terms( 'product_cat', $args );
$count = count($product_categories);
if ( $count > 0 ){
foreach ( $product_categories as $product_category ) {
echo '<h4><a href="' . get_term_link( $product_category ) . '">' . $product_category->name . '</a></h4>';
if (get_field('hexagon_text') ){
?>
<p><?php the_field('hexagon_text',
// specify correct post_id value for ACF
'product_cat_'.$product_category->term_id); ?></p>
<?php
}
if (get_field('hexagon_thumbnail') ){
?>
<img src="<?php the_field('hexagon_thumbnail',
// specify correct post_id value for ACF
'product_cat_'.$product_category->term_id); ?>" />
<?php
}
}
}
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.