The is_date function will help us with this. This function allows us to check whether we are in the archive by date.
Example – check if we are on the archive page by date and display the archive name, if not display the page name by function wp_title (”).
<?php if(is_date()) { the_archive_title('<h1 class="page-title">', '</h1>'); } else { wp_title(""); } ?>