Im having trouble displaying my background image.
I have created a loop to display my posts and then trying to set background image, however it's breaking somewhere? Below is my code within the loop.
<div class="artist-feed">
<?php
$artistloop = new WP_Query( array( 'post_type' => 'artist') );
if ( $artistloop->have_posts() ) :
while ( $artistloop->have_posts() ) : $artistloop->the_post(); ?>
<a href="<?php the_permalink(); ?>">
<div class="single-artist" style="background-image: url(<?php echo the_post_thumbnail(); ?>);">
<div class="artist-info">
<h2><?php echo get_the_title(); ?></h2>
</div>
</div>
</a>
<?php endwhile;
endif;
wp_reset_postdata();
?>
</div>
Aucun commentaire:
Enregistrer un commentaire