Featured Images of Publications by a CPT Within a Taxonomy
-
Hello,
My goal is to display the images on the front page of a CPT’s publications within a taxonomy.
I would like this display to be miniature and use the srcset attribute.
I am using ACF to create my image field using the Format in the “Image Data (Table)” template.
Here is the code I am using on taxonomy-mataxo.php:
<?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <?php $image = get_field('image_1'); ?> <img class="photoid" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <?php endwhile; ?> <?php endif; ?>
I get the display of the images but of course without managing to use a display in “medium” format and without the precious srcset attribute (essential for LazyLoad … well I think)
I understand that I must first in ACF use another Format in the template which would be “Image ID”
But for the moment my code does not work at all!
Is there any feedback on the subject?
- The topic ‘Featured Images of Publications by a CPT Within a Taxonomy’ is closed to new replies.