Home › Forums › Front-end Issues › get_terms If Have Any Content in WYSIWYG Field › Reply To: get_terms If Have Any Content in WYSIWYG Field
Actually, I think I solved this finally using part of a snippet I found pages deep on my Google search. I also didn’t realize I needed to specify which category to get the field data from even though I’m inside a foreach statement. get_field(‘category_bare_care’, $hiterm) is working fine. Hope this helps someone else!
<ul>
<?php $hiterms = get_terms("foxyshop_categories", array("orderby" => "menu_order", "parent" => 0)); ?>
<?php foreach($hiterms as $key => $hiterm) : ?>
<li>
<?php echo $hiterm->name; ?>
<?php if (get_field('category_bare_care', $hiterm)) :
the_field('category_bare_care', $hiterm);
endif; ?>
<?php $loterms = get_terms("foxyshop_categories", array("orderby" => "menu_order", "parent" => $hiterm->term_id)); ?>
<?php if($loterms) : ?>
<ul>
<?php foreach($loterms as $key => $loterm) : ?>
<li>
<?php echo $loterm->name; ?>
<?php if (get_field('category_bare_care', $loterm)) :
the_field('category_bare_care', $loterm);
endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
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.