Example 1 — Any category archive
Print a label above the post list.
<?php if ( is_category() ) {
echo '<p>Category: ' . single_cat_title( '', false ) . '</p>';
} ?> How It Works
is_category()is true on category archives only.single_cat_title()returns the name when the second argument isfalse.- Tag and date archives skip the code.

