Home › Forums › ACF PRO › get value under woocommerce query › Reply To: get value under woocommerce query
I’m not exactly sure what you mean by query.
Looking at your code, displaying the fields from the category would look something like this.
<?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('text_field_name') ){
?>
<p><?php the_field('text_field_name'); ?></p>
<?php
}
if (get_field('cat_thumbnail') ){
?>
<img src="<?php the_field('cat_thumbnail'); ?>" />
<?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.