I'm kinda stuck. I want to show 3 sections on an author page. Section one shows all uploaded images by author based on tag Tattoo. Section two shows all uploaded images by author based on tag Piercing. Section three shows all uploaded images by author based on tag Modification. So far so good. This is the code I'm using to do this for one section:
<!--- start test --->
<div class="uk-grid" data-uk-grid-margin>
<div class="uk-width-1-1">
<h2>Tattoo Work by <span style="text-transform: capitalize;"><?php the_author_meta('user_nicename'); ?></span>:</h2>
<ul id="switcher-content" class="uk-switcher">
<li class="uk-active">
<div class="uk-grid" data-uk-grid-margin>
<?php // Loop Tattoo
$first_query = new WP_Query('cat=1&author=' . $post->post_author . '&order=DESC&tag=Tattoo&posts_per_page=1000');
while($first_query->have_posts()) : $first_query->the_post(); ?>
<div class="uk-width-medium-1-4">
<a href="<?php the_permalink() ?>?MediaTag=Tattoo">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('artiststhumbnailsize');
}
?>
</a>
</div>
<?php endwhile;
wp_reset_postdata(); ?>
</div>
</li>
</ul>
</div>
</div>
<!--- end test --->`
BUT, I want to display the h2 title per section only if the section has images. To prevent the h2 title is displayed without ever having images below. So I kinda need to pre check the query and I can't find any thing to make this happen. The other two queries are $second_query and $third_query with each their own tag definition. Thanks for the help in advance!