Skip to content

How to use in a picture tag for responsive images. #64

Open
@tomasts248

Description

@tomasts248

It works on regular images, buy I'm unable to get it to work with

<picture>
                    <?php $image2xretina = wp_get_attachment_image_src(get_sub_field('imagen_de_fondo'), 'orginal'); ?>
                    <?php $image1xretina = wp_get_attachment_image_src(get_sub_field('imagen_de_fondo'), 'orginal'); ?>
                      <source srcset="<?php echo $image2xretina[0]; ?>" media="(min-width: 1600px)">
                      <source srcset="<?php echo $image1xretina[0]; ?> 1x, <?php echo $image2xretina[0]; ?> 2x">
                      <img class="thumbnail img-fluid imagen-fondo" srcset="<?php echo $image2xretina[0]; ?>" alt="<?php the_title(); ?>">
                   </picture>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions