0

I'm trying to pull in an image as a background image, but I get the syntax error "unexpected 'echo' (T_ECHO)". Below is my code which I think is accurate, but I'm sure I'm missing something small to get it working properly.

<?php
        $img = get_field(user_image);
        $imgURL = $img['url'];
        $query = new WP_Query( array(
            'post_type' => 'name',          // name of post type
            'tax_query' => array(
                array(
                    'taxonomy' => 'indicator',   // taxonomy name
                    'field'    => 'slug',
                    'terms'    => 'persons'
                )
            )
        ) );

        while ( $query->have_posts() ) : $query->the_post();
            echo'
         <div class="col-md-4 blog-single">
        <a href="#"><div class="blog-header" style="background-image:url('. echo $imgURL .');"></div></a>
        <div class="blog-single-content">
          <a href="<?php the_permalink(); ?>" class="h3 secondary">'.get_the_title().'</a>
          <a class="read-more-full btn btn-accent small dark-btn mt-3" href="'.get_permalink() .'">Learn More</a>
        </div>
            </div>';
        endwhile;
        wp_reset_query();
        ?>
M. Straw
  • 440
  • 12
  • 26

0 Answers0