samedi 11 avril 2015

ACF Fields and Taxonomy Image size?

I have an ACF image field associated with taxonomies , it pulls in a custom image to be used on the archive page. It list's all Taxonomies with the image , short description and link to each taxonomy archive.


I have it working with the code i found below , no loop , just pulling in the fields.


Question is : How can i include a custom image or call a thumbnail ? i've tried lost of variations to show a thumbnail , but somehow nothing shows up ?


With the code below , the image field is set to return the 'URL' and it works , but i would like to control the image size. Don't know how to enter that ?


image field named - tax-image



<?php


$libargs=array(
'hide_empty' => 0,
'parent' => 0,
'taxonomy' => 'compressor-range');

$libcats=get_categories($libargs);

foreach($libcats as $lc){
$termlink = get_term_link( $lc->slug, 'compressor-range' );

?>

<div class="row tax-list">

<div class="tax-img">
<a href="<?php echo $termlink; ?>"><img src="<?php the_field('tax_image' , 'compressor-range_'.$lc->term_id); ?>" alt="view range"/></a>
</div>

<div class="tax-description">
<h2><a href="<?php echo $termlink; ?>"><?php echo $lc->name; ?> Range</a></h2>
<?php the_field('tax_description', 'compressor-range_'.$lc->term_id); ?><a href="<?php echo $termlink; ?>"> ....View the range</a>
</div>

</div>

<?php }

Aucun commentaire:

Enregistrer un commentaire