Example 1 — Monthly archive title
Print the month and year in a heading.
<?php if ( is_month() ) {
echo '<h1>Archive: ' . single_month_title( ' ', false ) . '</h1>';
} ?> How It Works
is_month()is true on the month page.single_month_title()returns the month text when the second argument isfalse.- Year and day archives skip the code.

