Support

Account

Home Forums General Issues want to display Category Image in loop Reply To: want to display Category Image in loop

  • Hi @pagol

    Could you please tell me what did you mean by “only active category value”? Did you mean only show categories that have the “cat_thumbnail_image” field value? If that’s the case, I believe you can do it like this:

    foreach($categories as $category){ 
        
    	$image = get_field('cat_thumbnail_image', $category->taxonomy . '_' . $category->term_id );
        
        // Check if the image exists
        if( $image ){
            echo '<div class="test">'.$image.'</div>';
        }
    	
    }

    If that is not what you want, could you please explain it to me again?

    Thanks 🙂