Support

Account

Home Forums ACF PRO Taxonomy Field Image Size ??

Helping

Taxonomy Field Image Size ??

  • I have a field attached to a Taxonomy , it’s for an image. The code i found works to display the image , but i cannot set a size?

    The field is set to return the ‘URL’ and this does display the image , but i cannot work out how to insert a size such as a ‘thumbnail’ or other custom size into that src= ?

    Field name is ‘tax-image’

    I’ve trawled dozens of threads and tried so many variations , but cannot work how to insert the image size ?

    Can anyone please help

    
    $libcats=get_categories($libargs);  
       
       foreach($libcats as $lc){ 
       $termlink = get_term_link( $lc->slug, 'compressor-range' ); 
    
     <a href="<?php echo $termlink; ?>"><img src="<?php the_field('tax_image' , 'compressor-range_'.$lc->term_id); ?>" alt="view range"/></a>
    
    
  • When you wan to use different sized images then you need to either return an image array and then get the right URL form the returned array or return an the image id and use the WP function wp_get_attachment_image_src() or wp_get_attachment_image()

    I prefer using the latter.

    For more information on the image field see http://www.advancedcustomfields.com/resources/image/

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Taxonomy Field Image Size ??’ is closed to new replies.