css - Trying to hide image styling, if no image is present - Advanced Custom Fields images -


i have styled images on content page template have borders, backgrounds , box-shadow. if don't use optional image field , leave empty, leaves css styling small box. have been trying hide entire .content-img class if there no image present. code below works fine rendering images if present. how hide if no image present.

<?php the_field('top_headline'); ?></h1>
<div class="content-top"><?php the_field('content_top'); ?></div> <div class="content-img"><?php $image = get_field('content_image'); $size = 'medium'; // (thumbnail, medium, large, full or custom size) if( $image ) { echo wp_get_attachment_image( $image, $size ); } ?>

thanks in advance.

so took care of using css instead of in array. instead of using css class .content-img (which parent div), added image class .content-img img , if no image present, css wont show.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -