Support

Account

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>