Support » Developing with WordPress » Background image with wp_get_attachment_image_srcset();

  • Resolved lotsamottsa


    I’m trying to load a background image with wp_get_attachment_image_srcset insted of wp_get_attachment_image_src. When I replace my original code, my image doesn’t show up. Am I missing a step? Here is my code:

    	<?php $feature = wp_get_attachment_image_srcset( get_post_thumbnail_id($post->ID), '' );?>
       <section id="article-banner" class="animated fadeIn" style="background-image: url('<?php echo $feature['0'];?>');background-position:<?php the_field('alignment'); ?>;" title="<?php echo  $feature['title'];?>"> 

    Any help is greatly appreciated.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Background image with wp_get_attachment_image_srcset();’ is closed to new replies.