Also very keen to do this! Has anyone got it working?
Ok, so I didn’t figure out how to get the taxonomy to pull in the fields from the latest post but…
I did figure out how to show the fields from the actual taxonomy (‘categoria’), rather than one of its posts:
if (is_tax()) {
while( has_sub_field('imagens', 'categoria_'.$wp_query->queried_object->term_id) ):
//stuff
endwhile;
} else {
while( has_sub_field('imagens') ):
//stuff
endwhile;
}
Would still prefer for it to automatically grab from the latest post if anyone can offer an answer?
Thanks!
Thanks! I’ve ended up using this in order to still have a fallback image using Get The Image:
<?php $attachment_id = get_field('product_image');
$size = "thumbnail";
$image = wp_get_attachment_image_src( $attachment_id, $size );
if ( $image != 0 ) { ?>
<img src="<?php echo $image[0]; ?>" />
<?php } else {
get_the_image( array( 'size' => 'thumbnail', 'default_image' => get_stylesheet_directory_uri() . '/images/placeholder.jpg' ) );
} ?>