I´d like to automatically load three images inside all posts (via single.php), always in the same div (.acf_imgs-centro1). The idea is that the images are uploaded into uploads folder, with the same name as the post, and then they will be displayed inside the post. I can do it using the code bellow, but there is a problem... I have a static title (.imgs_h2) above the images divs, and I want it (the title) to load only since there are any image loaded. I can, for example, have the post and not yet have the image in the folder, so the title will be invisible. No Image, no title. Right now, the method i´m using seems incompatible with what I want to achiev. Any help is appreciated.
<div class="acf_imgs-centro1">
<h2 class="imgs_h2">Compartilhe nas redes sociais</h2>
<div class="img-neutra">
<img alt="Significado de <?php the_title(); ?>" src="http://teste.significadodosnomes.com.br/wp-content/uploads/nomes-unisex/<?php echo $post->post_name; ?>.jpg" onerror="this.style.opacity='0'" >
</div>
<div class="img-fem">
<img alt="Significado de <?php the_title(); ?>" src="http://teste.significadodosnomes.com.br/wp-content/uploads/nomes-femininos/<?php echo $post->post_name; ?>.jpg" onerror="this.style.opacity='0'"></div>
<div class="img-masc">
<img alt="Significado de <?php the_title(); ?>" src="http://teste.significadodosnomes.com.br/wp-content/uploads/nomes-masculinos/<?php echo $post->post_name; ?>.jpg" onerror="this.style.opacity='0'" ></div>
</div>