samedi 5 août 2017

Inline PHP If statement returns url outside of background-image style

Not sure where I've gone wrong? Researching this has provided me with not solutions.

<?php echo ( has_post_thumbnail() ? 'background-image: url('. the_post_thumbnail_url() .');' : 'height: auto;' ); ?>

This is what I see returned in the browser.

<div class="image" style="background-image: url('//192.168.50.4:3000/wp-content/uploads/2017/07/rns-placeholder.png ');">

Aucun commentaire:

Enregistrer un commentaire