Home › Forums › General Issues › Custom Post Type Category Image › Reply To: Custom Post Type Category Image
Thanks @hube2! I think it was one of your previous replies that helped me solve my issue prior to you responding to my post. Here’s the full final code for anyone else having issues. Also, the image field in ACF settings is set to Image ID. I have this set to take advantage of WordPress serving up responsive images.
<div class="inner-row large-up-3 small-up-2">
<?php
$taxonomy = 'jobpost_category';
$terms = get_terms($taxonomy, $args = array(
'hide_empty' => false,
));
?>
<?php foreach( $terms as $term ) :
$catIMG = get_field('job_cat_image', 'jobpost_category_' . $term->term_id);
?>
<a class="image-nav-block" id="post-<?php the_ID(); ?>" href="<?php echo get_term_link($term->slug, $taxonomy); ?>">
<div class="nav-block-overlay">
<div class="title-overlay">
<?php echo $term->name; ?>
</div>
<?php echo wp_get_attachment_image($catIMG, 'medium'); ?>
</div>
</a>
<?php endforeach;?>
</div>
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.