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

  • Resolved lotsamottsa

    (@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'];?>"> 
    	
    	</section>

    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)
  • You must be logged in to reply to this topic.