Show heading only if there are posts in a category in WordPress

I need to show a heading over a category and it must only be shown if there are posts in the category in WordPress. The heading should not be placed over every post. How can it be solved?

The code I got right now:

<?php query_posts('category_name=onestar&showposts=5'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
         <div class="wrapper orangecolor">
             <article class="intro">
                 <h2><?php the_title(); ?></h2>
                 <div><?php the_content(); ?></div>
             </article>
         </div>
<?php endwhile; ?>
<?php endif; ?>

Related posts

Leave a Reply

1 comment

  1. <?php query_posts('category_name=onestar&showposts=5'); ?>
    <?php if ( have_posts() ) : ?>
        Put the header here
        <?php while ( have_posts() ) : the_post(); ?>
             <div class="wrapper orangecolor">
                 <article class="intro">
                     <h2><?php the_title(); ?></h2>
                     <div><?php the_content(); ?></div>
                 </article>
             </div>
        <?php endwhile; ?>
    <?php endif; ?>