I'm setting up a gallery. If the image has an external link (using caption for input), it should follow the link. If not, it should follow the image url. I've got this, but it's not working.
<?php if $image['caption'] === '': ?>
<a href="<?php echo $image['url']; ?>" style="background-image:url(<?php echo $image['url']; ?>)"/>
<?php else: ?>
<a href="<?php echo $image['caption']; ?>" style="background-image:url(<?php echo $image['url']; ?>)"/>
<?php endif; ?>
I also thought this might've worked, but didn't:
<?php if empty($image['caption']): ?>
How can I accomplish this?
Aucun commentaire:
Enregistrer un commentaire