Home > Back-end >  How to show all categories of custom post type with category thumbnail which is created by ACF in a
How to show all categories of custom post type with category thumbnail which is created by ACF in a

Time:07-26

How to show all categories of custom post type with category thumbnail which is created by ACF in a loop?

    <div >
        <div >
            <div >
                <div >
                    <img src="img/brintons-3.jpg" alt="">
                </div>
                <h3>Royal Marquis</h3>
                <a href="#"></a>
            </div>
        </div>
    </div>
</div>```

CodePudding user response:

$terms = get_terms( array(
   'taxonomy' => 'taxonomy_slug', // enter your taxonomy slug here
   'hide_empty' => false,
) );
foreach($terms as $term) {
    $img = get_field('img_field_name', $term); // enter your img field name here
    $term_name = $term->name;

    // TODO: Your HTML code here
}
  • Related